Skip to content

Add ECR

Add ECR #293

Workflow file for this run

name: unstable
on:
push:
branches-ignore:
- main
permissions:
contents: read
id-token: write
jobs:
push-docker-image:
name: Build and Push 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 short hash
run: echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $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 -- temporarily disable multi-arcxh
tags: |
${{ vars.ECR_TESTING_URL }}/${{ github.event.repository.name }}-${{ matrix.os }}:${{ env.SHORT_SHA }}