Publish image to Public ECR #15
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: Publish image to Public ECR | |
on: | |
workflow_dispatch: | |
inputs: | |
image-folder: | |
description: 'The folder that contains the Dockerfile to build' | |
required: true | |
image-tag: | |
description: 'The image tag to build' | |
required: true | |
jobs: | |
publish_to_public_ecr: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Build info | |
run: | | |
echo "image folder ${{ github.event.inputs.image-folder }}" | |
echo "image tag ${{ github.event.inputs.image-tag }}" | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: us-east-1 | |
- name: Login to Amazon ECR Public | |
id: login-ecr-public | |
uses: aws-actions/amazon-ecr-login@v1 | |
with: | |
registry-type: public | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
with: | |
platforms: linux/amd64,linux/arm64 | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: "${{ github.event.inputs.image-folder }}" | |
push: true | |
tags: public.ecr.aws/kubefirst/${{ github.event.inputs.image-folder }}:${{ github.event.inputs.image-tag }} |