mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-30 13:10:47 +00:00
testing streamlined approach to pushing and caching in github actions
This commit is contained in:
parent
17b5464acf
commit
118fec54f6
1 changed files with 8 additions and 25 deletions
33
.github/workflows/deploy_sap_model_lambda.yml
vendored
33
.github/workflows/deploy_sap_model_lambda.yml
vendored
|
|
@ -22,10 +22,6 @@ jobs:
|
||||||
npm install -g serverless
|
npm install -g serverless
|
||||||
npm install -g serverless-domain-manager
|
npm install -g serverless-domain-manager
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: |
|
|
||||||
python -m pip install --upgrade pip
|
|
||||||
|
|
||||||
- name: AWS credentials for dev
|
- name: AWS credentials for dev
|
||||||
if: github.ref == 'refs/heads/dev'
|
if: github.ref == 'refs/heads/dev'
|
||||||
uses: aws-actions/configure-aws-credentials@v1
|
uses: aws-actions/configure-aws-credentials@v1
|
||||||
|
|
@ -54,28 +50,15 @@ jobs:
|
||||||
- name: Setup Docker
|
- name: Setup Docker
|
||||||
uses: docker/setup-buildx-action@v1
|
uses: docker/setup-buildx-action@v1
|
||||||
|
|
||||||
- name: Cache Docker layers
|
# Building and pushing Docker image with caching
|
||||||
uses: actions/cache@v2
|
- name: Build and push Docker image
|
||||||
|
uses: docker/build-push-action@v4
|
||||||
with:
|
with:
|
||||||
path: /tmp/.buildx-cache
|
context: ./model_data/simulation_system
|
||||||
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
push: true
|
||||||
restore-keys: |
|
tags: ${{ steps.set_ecr_credentials.outputs.ecr_uri }}:${{ github.sha }}
|
||||||
${{ runner.os }}-buildx-
|
cache-from: type=gha
|
||||||
|
cache-to: type=gha,mode=max
|
||||||
- name: Build Docker Image
|
|
||||||
run: |
|
|
||||||
cd model_data/simulation_system
|
|
||||||
docker buildx create --use
|
|
||||||
docker buildx build --load --cache-from=type=local,src=/tmp/.buildx-cache --cache-to=type=local,dest=/tmp/.buildx-cache --build-arg BUILDKIT_INLINE_CACHE=1 --tag lambda-sap-prediction-image:${{ github.sha }} -f Dockerfiles/Dockerfile.prediction.lambda .
|
|
||||||
|
|
||||||
- name: Login to ECR
|
|
||||||
run: |
|
|
||||||
aws ecr get-login-password --region eu-west-2 | docker login --username AWS --password-stdin ${{ steps.set_ecr_credentials.outputs.ecr_uri }}
|
|
||||||
|
|
||||||
- name: Tag and Push Docker Image to ECR
|
|
||||||
run: |
|
|
||||||
docker tag lambda-sap-prediction-image:${{ github.sha }} ${{ steps.set_ecr_credentials.outputs.ecr_uri }}:${{ github.sha }}
|
|
||||||
docker push ${{ steps.set_ecr_credentials.outputs.ecr_uri }}:${{ github.sha }}
|
|
||||||
|
|
||||||
- name: Deploy to AWS Lambda via Serverless
|
- name: Deploy to AWS Lambda via Serverless
|
||||||
env:
|
env:
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue