Skip to content

Build base images

Build base images #29

Workflow file for this run

name: Build base images
on:
workflow_dispatch:
defaults:
run:
shell: bash
jobs:
dockerhub:
name: DockerHub
strategy:
matrix:
tag: [11, 17, 21, latest]
include:
- tag: 11
java: 11
- tag: 17
java: 17
- tag: 21
java: 21
- tag: latest
java: 23
runs-on: ubuntu-latest
timeout-minutes: 10
env:
BASE_IMAGE: azul/zulu-openjdk:${{ matrix.java }}-jre-headless-latest
steps:
- name: Checkout
uses: actions/checkout@v4
# Set up emulator for non-native platforms (the GH runners are on amd64 architecture)
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: arm64
# Docker Buildx allows easy cross-building for different platforms
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
platforms: linux/amd64,linux/arm64
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Get current java version for detailled tags
id: java
run: |
docker pull "$BASE_IMAGE"
version=$(docker run --rm "$BASE_IMAGE" java -version 2>&1 | awk -F '"' '/version/ {print $2}')
echo "version=$version" # DEBUG echo
echo "version=$version" >> "$GITHUB_OUTPUT"
# build-push-action relies on Docker Buildx
- name: Build and push
uses: docker/build-push-action@v6
with:
push: true
context: .
platforms: linux/amd64,linux/arm64
tags: gatlingcorp/openjdk-base:${{ matrix.tag }}-jre-headless
build-args: |
BASE_IMAGE=${{ env.BASE_IMAGE }}
JAVA_MAJOR=${{ matrix.java }}
JAVA_VERSION=${{ steps.java.outputs.version }}