-
Notifications
You must be signed in to change notification settings - Fork 0
π Practical Workshop: Deploy Different API Strategies with Minimal Code Changes #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
macalbert
wants to merge
4
commits into
main
Choose a base branch
from
deployFastApi
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
d5197ce
feat(docker): add Dockerfile for FastAPI application and update iac cβ¦
macalbert aab89b4
refactor(docker): update Dockerfile comments for clarity on RIC usage
macalbert 3d5e51a
feat(api): enhance FastAPI responses with detailed models and summaries
macalbert 5715e22
fix(api): update Swagger UI endpoint to /swagger
macalbert File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 8 additions & 6 deletions
14
...hop/src/apps/FastApiApp/Dockerfile.lambda β workshop/src/apps/FastApiApp/Dockerfile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,18 +1,20 @@ | ||
| # Use AWS Lambda Python base image with RIC | ||
| # Use AWS Lambda Python base image without RIC | ||
| FROM public.ecr.aws/lambda/python:3.9 | ||
|
|
||
| EXPOSE 8000 | ||
|
|
||
| # Set environment variables for Lambda | ||
| ENV PYTHONPATH=${LAMBDA_TASK_ROOT} | ||
| ENV DEPLOYMENT_TYPE=lambda | ||
| ENV IMAGE_TYPE=custom | ||
| ENV RUNTIME_INTERFACE=ric | ||
| ENV IMAGE_TYPE=public.ecr.aws/lambda/python:3.9 | ||
| ENV RUNTIME_INTERFACE=direct | ||
|
|
||
| # Copy requirements and install dependencies | ||
| COPY requirements.txt ${LAMBDA_TASK_ROOT} | ||
| COPY workshop/src/apps/FastApiApp/requirements.txt ${LAMBDA_TASK_ROOT} | ||
| RUN pip install --no-cache-dir -r requirements.txt | ||
|
|
||
| # Copy application files | ||
| COPY main.py ${LAMBDA_TASK_ROOT} | ||
| COPY lambda_handler.py ${LAMBDA_TASK_ROOT} | ||
| COPY workshop/src/apps/FastApiApp ${LAMBDA_TASK_ROOT} | ||
|
|
||
| # Set the CMD to your handler | ||
| CMD ["lambda_handler.lambda_handler"] | ||
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| # Using public Python slim image with RIC | ||
| FROM python:3.9-slim | ||
|
|
||
| # Set working directory | ||
| ARG LAMBDA_TASK_ROOT="/var/task" | ||
| RUN mkdir -p ${LAMBDA_TASK_ROOT} | ||
| WORKDIR ${LAMBDA_TASK_ROOT} | ||
|
|
||
| # Set environment variables | ||
| ENV PYTHONPATH=${LAMBDA_TASK_ROOT} | ||
| ENV DEPLOYMENT_TYPE=lambda | ||
| ENV IMAGE_TYPE=python:3.9-slim | ||
| ENV RUNTIME_INTERFACE=ric | ||
|
|
||
| # Expose port | ||
| EXPOSE 8000 | ||
|
|
||
| COPY workshop/src/apps/FastApiApp/requirements.txt . | ||
|
|
||
| # Install the function's dependencies | ||
| RUN pip install awslambdaric | ||
| RUN pip install --no-cache-dir -r requirements.txt | ||
|
|
||
| COPY workshop/src/apps/FastApiApp . | ||
|
|
||
| # Set runtime interface client as default command for the container runtime | ||
| ENTRYPOINT [ "/usr/local/bin/python", "-m", "awslambdaric" ] | ||
|
|
||
| # Pass the name of the function handler as an argument to the runtime | ||
| CMD ["lambda_handler.lambda_handler"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.