one off push to ECR #1
Workflow file for this run
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
name: docker push containers to dockerhub and ecr | |
on: | |
push: | |
workflow_call: | |
inputs: | |
build-options: | |
description: Additional options to pass to docker buildx build | |
type: string | |
context: | |
default: "." | |
description: Context (directory) of the docker build process | |
type: string | |
docker-image-repository: | |
description: Docker repository (e.g. senzing/senzingapi-runtime) | |
required: true | |
type: string | |
docker-registry-server: | |
default: docker.io | |
description: Docker registry server | |
type: string | |
ecr-image-repository: | |
description: ECR repository (e.g. senzing/senzingapi-runtime) | |
required: true | |
type: string | |
image-tag: | |
default: latest | |
description: Docker image tag | |
type: string | |
platforms: | |
default: "linux/amd64" | |
type: string | |
secrets: | |
AWS_DOCKER_ACCOUNT_ID: | |
required: true | |
DOCKERHUB_ACCESS_TOKEN: | |
required: true | |
DOCKERHUB_USERNAME: | |
required: true | |
permissions: | |
id-token: write # This is required for requesting the JWT | |
contents: read # This is required for actions/checkout | |
jobs: | |
docker-push-containers-to-dockerhub-and-ecr: | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
submodules: recursive | |
- name: set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
env: | |
AWS_REGION: "us-east-1" | |
with: | |
role-to-assume: arn:aws:iam::${{ secrets.AWS_DOCKER_ACCOUNT_ID }}:role/github-actions-ecr-push | |
role-session-name: GitHub_to_AWS_via_FederatedOIDC | |
aws-region: ${{ env.AWS_REGION }} | |
- name: login to Amazon ECR Public | |
id: login-ecr-public | |
uses: aws-actions/amazon-ecr-login@v2 | |
with: | |
registry-type: public | |
- name: docker build images | |
shell: bash | |
env: | |
ECR_REGISTRY_SERVER: ${{ steps.login-ecr-public.outputs.registry }} | |
run: | | |
docker buildx build \ | |
--push \ | |
--platform linux/arm64,linux/amd64 \ | |
--build-arg BASE_IMAGE=public.ecr.aws/senzing/senzingapi-runtime:staging \ | |
--build-arg SENZING_APT_INSTALL_TOOLS_PACKAGE=senzingapi-tools=3.10.4-24184 \ | |
--tag ${{ env.ECR_REGISTRY_SERVER }}/senzing/senzingapi-tools:staging \ | |
--push \ | |
. |