Spaces:
Sleeping
Sleeping
Clement Vachet
commited on
Commit
·
0c345cc
1
Parent(s):
c8a57bb
Add github action
Browse files
.github/workflows/update_ECR_lambda.yml
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Update ECR and Lambda
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
workflow_dispatch:
|
| 5 |
+
|
| 6 |
+
jobs:
|
| 7 |
+
update_ECR_lambda:
|
| 8 |
+
name: Update ECR docker image and Lambda function
|
| 9 |
+
runs-on: ubuntu-latest
|
| 10 |
+
steps:
|
| 11 |
+
- name: Check out the repo
|
| 12 |
+
uses: actions/checkout@v4
|
| 13 |
+
|
| 14 |
+
- name: Configure AWS Credentials
|
| 15 |
+
uses: aws-actions/configure-aws-credentials@v1
|
| 16 |
+
with:
|
| 17 |
+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
| 18 |
+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
| 19 |
+
aws-region: us-west-2
|
| 20 |
+
|
| 21 |
+
- name: Login to Amazon ECR
|
| 22 |
+
id: login-ecr
|
| 23 |
+
uses: aws-actions/amazon-ecr-login@v1
|
| 24 |
+
|
| 25 |
+
- name: Build, tag, and push image to Amazon ECR
|
| 26 |
+
env:
|
| 27 |
+
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
|
| 28 |
+
ECR_REPOSITORY: object-detection-lambda
|
| 29 |
+
IMAGE_TAG: latest
|
| 30 |
+
run: |
|
| 31 |
+
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
|
| 32 |
+
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
|
| 33 |
+
|
| 34 |
+
- name: Update Lambda with Docker image
|
| 35 |
+
env:
|
| 36 |
+
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
|
| 37 |
+
ECR_REPOSITORY: object-detection-lambda
|
| 38 |
+
IMAGE_TAG: latest
|
| 39 |
+
run: |
|
| 40 |
+
aws lambda update-function-code --function-name object-detection --image-uri $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
|