diff --git a/Dockerfile b/Dockerfile index 818dc03..bec352b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,5 +15,6 @@ COPY poetry.lock pyproject.toml ${LAMBDA_TASK_ROOT}/ RUN cd ${LAMBDA_TASK_ROOT} && poetry install --no-interaction --no-ansi --no-root --only main COPY ./ ${LAMBDA_TASK_ROOT}/ +ENV PYTHONPATH "${PYTHONPATH}:${LAMBDA_TASK_ROOT}" -CMD ["src/main.handler"] \ No newline at end of file +CMD ["src.main.handler"] \ No newline at end of file diff --git a/README.md b/README.md index 05332db..c3a3d1e 100644 --- a/README.md +++ b/README.md @@ -96,6 +96,7 @@ Test it
- Next time you will deploy the server will be exposed under your domain. 9. Deploy to AWS +Note - if you are building the docker image from a mac, change `architecture: x86_64` to `architecture: arm64` in the `serverless.yml` file. ``` ./scripts/deploy ``` diff --git a/serverless.yml b/serverless.yml index 8c83a05..c254b0a 100644 --- a/serverless.yml +++ b/serverless.yml @@ -43,7 +43,6 @@ provider: memorySize: 1024 # MB timeout: 30 endpointType: edge - lambdaHashingVersion: 20201221 # apiGateway: # metrics: true tracing: @@ -60,6 +59,8 @@ provider: cacheFrom: # This is the path where the serverless framework will put the image in ECR when created for the first time. - ${AWS::AccountId}.dkr.ecr.${self:provider.region}.amazonaws.com/serverless-fastapibackendservice-${self:provider.stage}:fastapi-backend-server + # build container to match the architecture: x86_64 param + platform: linux/amd64 iamRoleStatements: # handles the permissions of the lambda # XRay - Effect: Allow @@ -81,6 +82,8 @@ functions: app: image: name: fastapi-backend-server + architecture: x86_64 # default + # architecture: arm64 # works for docker images built on Mac M1/M2/M3/etc machines environment: STAGE: ${self:provider.stage} @@ -90,4 +93,4 @@ functions: path: / - http: method: any - path: /{proxy+} \ No newline at end of file + path: /{proxy+}