Skip to content

fix: update Dockerfile and deployment workflow for amd64 compatibility #5

fix: update Dockerfile and deployment workflow for amd64 compatibility

fix: update Dockerfile and deployment workflow for amd64 compatibility #5

Workflow file for this run

# Same OIDC role as registry deploy.yml. Repo var: AWS_ACCOUNT_ID.
name: Deploy Web to Lambda
on:
push:
branches:
- main
paths:
- 'web/**'
- '.github/workflows/deploy-web.yml'
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Configure AWS credentials (OIDC)
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::${{ vars.AWS_ACCOUNT_ID }}:role/devsper-deploy
aws-region: us-east-1
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
- name: Build and push Docker image
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: devsper-registry-web
IMAGE_TAG: ${{ github.sha }}
run: |
cd web
docker buildx build --provenance=false --platform linux/amd64 \
-t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG \
-t $ECR_REGISTRY/$ECR_REPOSITORY:latest \
-f Dockerfile.lambda \
--push .
- name: Update Lambda function
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: devsper-registry-web
IMAGE_TAG: ${{ github.sha }}
run: |
aws lambda update-function-code \
--function-name devsper-registry-web \
--image-uri $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
- name: Wait for function update to complete
run: |
aws lambda wait function-updated-v2 --function-name devsper-registry-web
- name: Invalidate CloudFront cache
run: |
aws cloudfront create-invalidation --distribution-id E1OSV9Y9DPR3CY --paths "/*"