changing working directory for lambda

This commit is contained in:
Khalim Conn-Kowlessar 2023-08-31 17:39:32 +01:00
parent 22ab70a888
commit 672877d165
3 changed files with 21 additions and 8 deletions

View file

@ -54,9 +54,19 @@ jobs:
- name: Setup Docker
uses: docker/setup-buildx-action@v1
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Build Docker Image
run: |
cd model_data/simulation_system && docker build -t lambda-sap-prediction-image:${{ github.sha }} -f Dockerfiles/Dockerfile.prediction.lambda . --load
cd model_data/simulation_system
docker buildx create --use
docker buildx build --push --cache-from=type=local,src=/tmp/.buildx-cache --cache-to=type=local,dest=/tmp/.buildx-cache --tag lambda-sap-prediction-image:${{ github.sha }} -f Dockerfiles/Dockerfile.prediction.lambda .
- name: Login to ECR
run: |

View file

@ -1,14 +1,17 @@
FROM public.ecr.aws/lambda/python:3.10
# Set the working directory
WORKDIR ${LAMBDA_TASK_ROOT}/simulation_system
# Install python packages
COPY ../requirements/predictions/predictions.txt requirements.txt
COPY ../requirements/predictions/predictions.txt ./requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
# Copy the project code to user home directory
COPY ./core ${LAMBDA_TASK_ROOT}/simulation_system/core
COPY ./MLModel ${LAMBDA_TASK_ROOT}/simulation_system/MLModel
COPY ./predictions.py ${LAMBDA_TASK_ROOT}/simulation_system/predictions.py
COPY ./handlers/predictions_app.py ${LAMBDA_TASK_ROOT}/simulation_system/predictions_app.py
# Copy the project code to the working directory
COPY ./core ./core
COPY ./MLModel ./MLModel
COPY ./predictions.py ./predictions.py
COPY ./handlers/predictions_app.py ./predictions_app.py
# Run off a lambda trigger
CMD [ "predictions_app.handler" ]

View file

@ -19,7 +19,7 @@ plugins:
custom:
customDomain:
domainName: api.${self:provider.environment.DOMAIN_NAME}
basePath: 'sapmodel'
basePath: 'v1/sapmodel'
createRoute53Record: true
certificateArn: ${ssm:/ssl_certificate_arn}