Skip to content
name: "Staging: Build and push docker container"
on:
workflow_dispatch:
repository_dispatch:
types: [common-voice-build-image-stage]
push:
branches:
- dev/ilt
jobs:
build-push:
runs-on: ubuntu-latest
steps:
- name: Checkout repository with submodules
uses: actions/checkout@v4
with:
token: ${{ secrets.PAT }}
submodules: recursive
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ca-central-1
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
- name: Build, tag, and push docker image to Amazon ECR
id: push-image
env:
REGISTRY: ${{ steps.login-ecr.outputs.registry }}
REPOSITORY: common-voice
IMAGE_TAG: stage-${{ github.sha }}
run: |
echo "image_tag=$IMAGE_TAG" >> $GITHUB_OUTPUT
CURRENT_UID=$(id -u):$(id -g) docker compose --project-name "common-voice" -f "docker-compose.yaml" build web
docker image ls
docker tag common-voice-web:latest $REGISTRY/$REPOSITORY:$IMAGE_TAG
docker push $REGISTRY/$REPOSITORY:$IMAGE_TAG
- name: Repository dispatch to trigger deployment
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.PAT }}
repository: ${{ vars.AWS_REPO }}
event-type: common-voice-deployment-stage
client-payload: '{"tag": "${{ steps.push-image.outputs.image_tag }}"}'