Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
CMD ["src.main.handler"]
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ Test it </br>
- 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
```
Expand Down
7 changes: 5 additions & 2 deletions serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ provider:
memorySize: 1024 # MB
timeout: 30
endpointType: edge
lambdaHashingVersion: 20201221
# apiGateway:
# metrics: true
tracing:
Expand All @@ -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
Expand All @@ -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}

Expand All @@ -90,4 +93,4 @@ functions:
path: /
- http:
method: any
path: /{proxy+}
path: /{proxy+}