Build Base Image #9
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: Build Base Image | |
on: | |
workflow_dispatch: | |
inputs: | |
context: | |
description: 'Dockerfile location in docker folder' | |
required: true | |
tags: | |
description: 'Docker image tags' | |
required: false | |
default: 'SNAPSHOT' | |
multi_arch: | |
description: 'Multi-arch flag, true: linux/amd64,linux/arm64 or false: linux/amd64' | |
type: boolean | |
required: false | |
default: true | |
push: | |
description: 'Push flag' | |
type: boolean | |
required: false | |
default: true | |
jobs: | |
build_image: | |
name: Build Docker Base Image | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout core | |
uses: actions/checkout@v4 | |
- name: Set Common Vars | |
run: | | |
PLATFORMS='linux/amd64' | |
[[ "${{ github.event.inputs.multi_arch }}" == 'true' ]] && PLATFORMS='linux/amd64,linux/arm64' | |
echo "PLATFORMS=${PLATFORMS}" >> $GITHUB_ENV | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3.0.0 | |
with: | |
platforms: amd64,arm64 | |
if: github.event.inputs.multi_arch == 'true' | |
- id: docker-setup-buildx | |
name: Docker Setup Buildx | |
uses: docker/setup-buildx-action@v3.0.0 | |
with: | |
platforms: ${{ env.PLATFORMS }} | |
driver-opts: | | |
image=moby/buildkit:v0.12.2 | |
if: github.event.inputs.multi_arch == 'true' | |
- name: Docker Hub login | |
uses: docker/login-action@v3.0.0 | |
with: | |
username: ${{ secrets.docker_io_username }} | |
password: ${{ secrets.docker_io_token }} | |
- name: Build and push | |
uses: docker/build-push-action@v5.0.0 | |
with: | |
context: ./docker/${{ github.event.inputs.context }} | |
push: ${{ github.event.inputs.push }} | |
tags: ${{ github.event.inputs.tags }} | |
platforms: ${{ env.PLATFORMS }} |