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 optionally 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: false | |
secret: true | |
aws-secret-access-key: | |
description: 'AWS Secret Access Key' | |
required: false | |
secret: true | |
push: | |
description: 'Push the Docker image to ECR' | |
required: false | |
default: 'false' | |
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: Build Docker image | |
id: docker_build | |
uses: docker/build-push-action@v5 | |
with: | |
builder: ${{ steps.buildx.outputs.name }} | |
context: api | |
push: ${{ inputs.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 |