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 Build and Push' | |
description: 'Build Docker image and push to ECR' | |
inputs: | |
tag: | |
description: 'Tag from branch name or PR number' | |
required: true | |
version: | |
description: 'Version for the Docker image' | |
required: true | |
aws-access-key-id: | |
description: 'AWS Access Key ID' | |
required: true | |
secret: true | |
aws-secret-access-key: | |
description: 'AWS Secret Access Key' | |
required: true | |
secret: true | |
runs: | |
using: "composite" | |
steps: | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Cache Docker layers | |
uses: actions/cache@v4 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- name: Configure AWS credentials for Kafka-UI account | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-access-key-id: ${{ inputs.aws-access-key-id }} | |
aws-secret-access-key: ${{ inputs.aws-secret-access-key }} | |
aws-region: us-east-1 | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v2 | |
with: | |
registry-type: 'public' | |
- name: Build and push Docker image | |
id: docker_build_and_push | |
uses: docker/build-push-action@v5 | |
with: | |
builder: ${{ steps.buildx.outputs.name }} | |
context: api | |
push: true | |
tags: public.ecr.aws/kafbat/kafka-ui-custom-build:${{ inputs.tag }} | |
build-args: | | |
JAR_FILE=api-${{ inputs.version }}.jar | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache |