Skip to content

Add ECR

Add ECR #30

Workflow file for this run

name: docker
on:
push:
branches:
- main
pull_request:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'push' && github.run_number || github.event.pull_request.number }}
cancel-in-progress: true
permissions:
contents: read
id-token: write
jobs:
docker:
name: Build Docker image
runs-on: ubuntu-latest
strategy:
matrix:
os:
- ubuntu
# temporarily disable red hat for faster build/deploy cycles
#- redhat
steps:
- name: Checkout code
uses: actions/checkout@v4
# temporarily disable multi-arch for faster build-deploy cycles
#- name: Setup QEMU
# uses: docker/setup-qemu-action@v3
# with:
# platforms: amd64,arm64
#- name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v3
- name: Login to Dockerhub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_RO_TOKEN }}
- name: Configure AWS credentials
if: ${{ github.event_name == 'push' }}
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ vars.ECR_TESTING_ROLE_ARN }}
aws-region: us-east-1
- name: Login to Amazon ECR
if: ${{ github.event_name == 'push' }}
uses: aws-actions/amazon-ecr-login@v2
- name: Get version
run: echo "VERSION=$(cat VERSION)" >> $GITHUB_ENV
- name: Docker Build and Push
uses: docker/build-push-action@v6
with:
context: .
file: ${{ matrix.os }}/Dockerfile
push: ${{ github.event_name == 'push' }}
platforms: linux/amd64 # ,linux/arm64 -- temporaily disable multi-arch
tags: |
${{ vars.ECR_TESTING_URL }}/${{ github.event.repository.name }}-${{ matrix.os }}:${{ env.VERSION }}
${{ vars.ECR_TESTING_URL }}/${{ github.event.repository.name }}-${{ matrix.os }}:latest