mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-30 13:10:47 +00:00
Merge pull request #191 from Hestia-Homes/main
changing working directory for lambda and added caching to actions
This commit is contained in:
commit
bdf05b883e
3 changed files with 21 additions and 8 deletions
12
.github/workflows/deploy_sap_model_lambda.yml
vendored
12
.github/workflows/deploy_sap_model_lambda.yml
vendored
|
|
@ -54,9 +54,19 @@ jobs:
|
||||||
- name: Setup Docker
|
- name: Setup Docker
|
||||||
uses: docker/setup-buildx-action@v1
|
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
|
- name: Build Docker Image
|
||||||
run: |
|
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
|
- name: Login to ECR
|
||||||
run: |
|
run: |
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,17 @@
|
||||||
FROM public.ecr.aws/lambda/python:3.10
|
FROM public.ecr.aws/lambda/python:3.10
|
||||||
|
|
||||||
|
# Set the working directory
|
||||||
|
WORKDIR ${LAMBDA_TASK_ROOT}/simulation_system
|
||||||
|
|
||||||
# Install python packages
|
# 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
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
# Copy the project code to user home directory
|
# Copy the project code to the working directory
|
||||||
COPY ./core ${LAMBDA_TASK_ROOT}/simulation_system/core
|
COPY ./core ./core
|
||||||
COPY ./MLModel ${LAMBDA_TASK_ROOT}/simulation_system/MLModel
|
COPY ./MLModel ./MLModel
|
||||||
COPY ./predictions.py ${LAMBDA_TASK_ROOT}/simulation_system/predictions.py
|
COPY ./predictions.py ./predictions.py
|
||||||
COPY ./handlers/predictions_app.py ${LAMBDA_TASK_ROOT}/simulation_system/predictions_app.py
|
COPY ./handlers/predictions_app.py ./predictions_app.py
|
||||||
|
|
||||||
# Run off a lambda trigger
|
# Run off a lambda trigger
|
||||||
CMD [ "predictions_app.handler" ]
|
CMD [ "predictions_app.handler" ]
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ plugins:
|
||||||
custom:
|
custom:
|
||||||
customDomain:
|
customDomain:
|
||||||
domainName: api.${self:provider.environment.DOMAIN_NAME}
|
domainName: api.${self:provider.environment.DOMAIN_NAME}
|
||||||
basePath: 'sapmodel'
|
basePath: 'v1/sapmodel'
|
||||||
createRoute53Record: true
|
createRoute53Record: true
|
||||||
certificateArn: ${ssm:/ssl_certificate_arn}
|
certificateArn: ${ssm:/ssl_certificate_arn}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue