-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added deploy.yml to us github actions to deploy container image to la…
…mbda
- Loading branch information
1 parent
1bca9d2
commit 0ed4171
Showing
2 changed files
with
48 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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,47 @@ | ||
name: Deploy to AWS Lambda | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
permissions: | ||
id-token: write # This is required for requesting the JWT | ||
contents: read # This is required for actions/checkout | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: configure aws credentials | ||
uses: aws-actions/configure-aws-credentials@v3 | ||
with: | ||
role-to-assume: arn:aws:iam::590312749310:role/github-actions-role | ||
role-session-name: lambda-gh-actions | ||
aws-region: ap-southeast-2 | ||
|
||
- name: Login to Amazon ECR | ||
id: login-ecr | ||
uses: aws-actions/amazon-ecr-login@v1 | ||
|
||
- name: Build Docker image | ||
run: docker build -t predictive_maintenance . | ||
|
||
- name: Tag Docker image | ||
run: docker tag predictive_maintenance:latest 590312749310.dkr.ecr.ap-southeast-2.amazonaws.com/predictive-maintenance:latest | ||
|
||
- name: Push Docker image to ECR | ||
run: docker push 590312749310.dkr.ecr.ap-southeast-2.amazonaws.com/predictive-maintenance:latest | ||
|
||
- name: update lambda function | ||
run: | | ||
aws lambda update-function-code \ | ||
--function-name predictive_maintenance \ | ||
--image-uri 590312749310.dkr.ecr.ap-southeast-2.amazonaws.com/predictive-maintenance:latest | ||
This file contains 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