Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 36 additions & 9 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ def agentSelector(String imageType, retryCounter) {
// Specify parallel stages
def parallelStages = [failFast: false]
[
'alpine_21',
'alpine_25',
'debian_21',
'debian_25',
'alpine_jdk21',
'alpine_jdk25',
'debian_jdk21',
'debian_jdk25',
'nanoserver-ltsc2019',
'nanoserver-ltsc2022',
'windowsservercore-ltsc2019',
Expand Down Expand Up @@ -82,8 +82,18 @@ def parallelStages = [failFast: false]
if (isUnix()) {
sh 'make publish'
} else {
powershell '& ./build.ps1 build'
powershell '& ./build.ps1 publish'
// JDK21 only
powershell '''
(Get-Content docker-bake.hcl -Raw) -replace '(variable\\s+"jdks_to_build"\\s*{\\s*default\\s*=\\s*)\\[[^\\]]*\\]', '$1[21]' | Set-Content docker-bake.hcl
& ./build.ps1 build
& ./build.ps1 publish
'''
// JDK25 only
powershell '''
(Get-Content docker-bake.hcl -Raw) -replace '(variable\\s+"jdks_to_build"\\s*{\\s*default\\s*=\\s*)\\[[^\\]]*\\]', '$1[25]' | Set-Content docker-bake.hcl
& ./build.ps1 build
& ./build.ps1 publish
'''
}
}
}
Expand All @@ -94,15 +104,32 @@ def parallelStages = [failFast: false]
if (isUnix()) {
sh 'make build'
} else {
powershell '& ./build.ps1 build'
archiveArtifacts artifacts: 'build-windows.yaml', allowEmptyArchive: true
// JDK21 only
powershell '''
(Get-Content docker-bake.hcl -Raw) -replace '(variable\\s+"jdks_to_build"\\s*{\\s*default\\s*=\\s*)\\[[^\\]]*\\]', '$1[21]' | Set-Content docker-bake.hcl
& ./build.ps1 build
'''
// JDK25 only
powershell '''
(Get-Content docker-bake.hcl -Raw) -replace '(variable\\s+"jdks_to_build"\\s*{\\s*default\\s*=\\s*)\\[[^\\]]*\\]', '$1[25]' | Set-Content docker-bake.hcl
& ./build.ps1 build
'''
archiveArtifacts artifacts: 'build-windows*.yaml', allowEmptyArchive: true
}
}
stage('Test') {
if (isUnix()) {
sh 'make test'
} else {
powershell '& ./build.ps1 test'
powershell '''
(Get-Content docker-bake.hcl -Raw) -replace '(variable\\s+"jdks_to_build"\\s*{\\s*default\\s*=\\s*)\\[[^\\]]*\\]', '$1[21]' | Set-Content docker-bake.hcl
& ./build.ps1 test
'''
// JDK25 only
powershell '''
(Get-Content docker-bake.hcl -Raw) -replace '(variable\\s+"jdks_to_build"\\s*{\\s*default\\s*=\\s*)\\[[^\\]]*\\]', '$1[25]' | Set-Content docker-bake.hcl
& ./build.ps1 test
'''
}
junit 'target/**/junit-results*.xml'
}
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ check_cli = type "$(1)" >/dev/null 2>&1 || { echo "Error: command '$(1)' require
check_image = $(MAKE) --silent list listgroup-linux | grep -w '$(1)' >/dev/null 2>&1 || { echo "Error: the image or group '$(1)' does not exist in manifest for the current platform '$(OS)/$(ARCH)'. Please check the output of '$(MAKE) list' or '$(MAKE) listgroup-linux'. Exiting." ; exit 1 ; }
# check_image = make --silent list | grep -w '$(1)' >/dev/null 2>&1 || { echo "Error: the image '$(1)' does not exist in manifest for the platform 'linux/$(ARCH)'. Please check the output of 'make list'. Exiting." ; exit 1 ; }
## Base "docker buildx base" command to be reused everywhere
bake_base_cli := docker buildx bake --file docker-bake.hcl --file docker-bake.override.json
bake_base_cli := docker buildx bake --file docker-bake.hcl
## Command to be used on build (only)
bake_cli := $(bake_base_cli) --load
## Default bake target
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ Note: you can generate this docker compose file from docker-bake.hcl yourself wi
# - Convert with yq to the format expected by docker compose
# - Store the result in the docker compose file

$ docker buildx bake --progress=plain --file=docker-bake.hcl --file docker-bake.override.json windows --print `
$ docker buildx bake --progress=plain --file=docker-bake.hcl windows --print `
| yq --prettyPrint '.target[] | del(.output) | {(. | key): {\"image\": .tags[0], \"build\": .}}' | yq '{\"services\": .}' `
| Out-File -FilePath build-windows.yaml
```
Expand Down
16 changes: 16 additions & 0 deletions adoptium/jdk_installers.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
jdk21/linux/amd64/glibc https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.11%2B10/OpenJDK21U-jdk_x64_linux_hotspot_21.0.11_10.tar.gz
jdk21/linux/arm64/glibc https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.11%2B10/OpenJDK21U-jdk_aarch64_linux_hotspot_21.0.11_10.tar.gz
jdk21/linux/ppc64le/glibc https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.11%2B10/OpenJDK21U-jdk_ppc64le_linux_hotspot_21.0.11_10.tar.gz
jdk21/linux/s390x/glibc https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.11%2B10/OpenJDK21U-jdk_s390x_linux_hotspot_21.0.11_10.tar.gz
jdk21/linux/amd64/musl https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.11%2B10/OpenJDK21U-jdk_x64_alpine-linux_hotspot_21.0.11_10.tar.gz
jdk21/linux/arm64/musl https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.11%2B10/OpenJDK21U-jdk_aarch64_alpine-linux_hotspot_21.0.11_10.tar.gz
jdk21/linux/riscv64/glibc https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.11%2B10/OpenJDK21U-jdk_riscv64_linux_hotspot_21.0.11_10.tar.gz
jdk21/windows/amd64 https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.11%2B10/OpenJDK21U-jdk_x64_windows_hotspot_21.0.11_10.zip
jdk25/linux/amd64/glibc https://github.com/adoptium/temurin25-binaries/releases/download/jdk-25.0.3%2B9/OpenJDK25U-jdk_x64_linux_hotspot_25.0.3_9.tar.gz
jdk25/linux/arm64/glibc https://github.com/adoptium/temurin25-binaries/releases/download/jdk-25.0.3%2B9/OpenJDK25U-jdk_aarch64_linux_hotspot_25.0.3_9.tar.gz
jdk25/linux/ppc64le/glibc https://github.com/adoptium/temurin25-binaries/releases/download/jdk-25.0.3%2B9/OpenJDK25U-jdk_ppc64le_linux_hotspot_25.0.3_9.tar.gz
jdk25/linux/s390x/glibc https://github.com/adoptium/temurin25-binaries/releases/download/jdk-25.0.3%2B9/OpenJDK25U-jdk_s390x_linux_hotspot_25.0.3_9.tar.gz
jdk25/linux/amd64/musl https://github.com/adoptium/temurin25-binaries/releases/download/jdk-25.0.3%2B9/OpenJDK25U-jdk_x64_alpine-linux_hotspot_25.0.3_9.tar.gz
jdk25/linux/arm64/musl https://github.com/adoptium/temurin25-binaries/releases/download/jdk-25.0.3%2B9/OpenJDK25U-jdk_aarch64_alpine-linux_hotspot_25.0.3_9.tar.gz
jdk25/linux/riscv64/glibc https://github.com/adoptium/temurin25-binaries/releases/download/jdk-25.0.3%2B9/OpenJDK25U-jdk_riscv64_linux_hotspot_25.0.3_9.tar.gz
jdk25/windows/amd64 https://github.com/adoptium/temurin25-binaries/releases/download/jdk-25.0.3%2B9/OpenJDK25U-jdk_x64_windows_hotspot_25.0.3_9.zip
22 changes: 13 additions & 9 deletions alpine/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

ARG JAVA_VERSION
ARG ALPINE_TAG=3.24.1
FROM alpine:"${ALPINE_TAG}" AS jre-build

Expand All @@ -30,18 +29,23 @@ SHELL ["/bin/ash", "-eo", "pipefail", "-c"]
# Ref. https://docs.docker.com/engine/reference/builder/#automatic-platform-args-in-the-global-scope
ARG TARGETPLATFORM

COPY jdk-download-url.sh /usr/bin/local/jdk-download-url.sh
COPY jdk-download.sh /usr/bin/local/jdk-download.sh

ARG JAVA_VERSION
ARG JAVA_RELEASE
COPY ./adoptium/jdk_installers.txt /tmp/jdk_installers.txt
ARG TEMP_JAVA_HOME=/opt/jdk
ENV PATH="${TEMP_JAVA_HOME}/bin:${PATH}"
# hadolint ignore=DL3018
RUN apk add --no-cache \
ca-certificates \
jq \
curl \
&& /usr/bin/local/jdk-download.sh alpine

ENV PATH="/opt/jdk-${JAVA_VERSION}/bin:${PATH}"
tar \
&& java_zip_url="$(grep "jdk${JAVA_RELEASE}/${TARGETPLATFORM}/musl" /tmp/jdk_installers.txt | cut -d' ' -f2)" \
&& mkdir -p "${TEMP_JAVA_HOME}" \
&& jdk_archive="/opt/jdk.zip" \
&& curl --silent --show-error --location --output "${jdk_archive}" "${java_zip_url}" \
# TODO: Verify download with GPG
&& tar xzf "${jdk_archive}" --strip-components=1 -C "${TEMP_JAVA_HOME}" \
&& java --version \
&& jlink --version

RUN case "$(jlink --version 2>&1)" in \
"21."*) set -- "--compress=zip-6" --add-modules ALL-MODULE-PATH ;; \
Expand Down
14 changes: 4 additions & 10 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ Param(
[String] $VersionTag = '0.0.1',
# Windows flavor and windows version to build
[String] $ImageType = 'nanoserver-ltsc2019',
# Generate a docker compose file even if it already exists
[switch] $OverwriteDockerComposeFile = $false,
# Print the build and publish command instead of executing them if set
[switch] $DryRun = $false,
# Pester version to install and use for tests
Expand Down Expand Up @@ -114,7 +112,7 @@ function Test-Image {
}

function Initialize-DockerComposeFile {
$baseDockerBakeCmd = 'docker buildx bake --progress=plain --file=docker-bake.hcl --file docker-bake.override.json'
$baseDockerBakeCmd = 'docker buildx bake --progress=plain --file=docker-bake.hcl'

$items = $ImageType.Split('-')
$windowsFlavor = $items[0]
Expand Down Expand Up @@ -154,13 +152,9 @@ Test-CommandExists 'docker-compose'
Test-CommandExists 'docker buildx'
Test-CommandExists 'yq'

# Generate the docker compose file if it doesn't exists or if the parameter OverwriteDockerComposeFile is set
if ((Test-Path $dockerComposeFile) -and -not $OverwriteDockerComposeFile) {
Write-Host "= PREPARE: The docker compose file '$dockerComposeFile' containing the image definitions already exists."
} else {
Write-Host "= PREPARE: Initialize the docker compose file '$dockerComposeFile' containing the image definitions."
Initialize-DockerComposeFile
}
# Generate the docker compose file (warning: will overwrite existing file)
Write-Host "= PREPARE: Initialize the docker compose file '$dockerComposeFile' containing the image definitions."
Initialize-DockerComposeFile

Write-Host '= PREPARE: List of images and tags to be processed:'
Invoke-Expression "$baseDockerCmd config"
Expand Down
23 changes: 14 additions & 9 deletions debian/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,24 @@ SHELL ["/bin/bash", "-e", "-u", "-o", "pipefail", "-c"]
# Ref. https://docs.docker.com/engine/reference/builder/#automatic-platform-args-in-the-global-scope
ARG TARGETPLATFORM

COPY jdk-download-url.sh /usr/bin/local/jdk-download-url.sh
COPY jdk-download.sh /usr/bin/local/jdk-download.sh

ARG JAVA_VERSION
ARG JAVA_RELEASE
COPY ./adoptium/jdk_installers.txt /tmp/jdk_installers.txt
ARG TEMP_JAVA_HOME=/opt/jdk
ENV PATH="${TEMP_JAVA_HOME}/bin:${PATH}"
# hadolint ignore=DL3008
RUN set -x; apt-get update \
RUN apt-get update \
&& apt-get install --no-install-recommends -y \
ca-certificates \
jq \
curl \
&& /usr/bin/local/jdk-download.sh

ENV PATH="/opt/jdk-${JAVA_VERSION}/bin:${PATH}"
tar \
&& java_zip_url="$(grep "jdk${JAVA_RELEASE}/${TARGETPLATFORM}/glibc" /tmp/jdk_installers.txt | cut -d' ' -f2)" \
&& mkdir -p "${TEMP_JAVA_HOME}" \
&& jdk_archive="/opt/jdk.zip" \
&& curl --silent --show-error --location --output "${jdk_archive}" "${java_zip_url}" \
# TODO: Verify download with GPG
&& tar xzf "${jdk_archive}" --strip-components=1 -C "${TEMP_JAVA_HOME}" \
&& java --version \
&& jlink --version

# Generate smaller java runtime without unneeded files
# for now we include the full module path to maintain compatibility
Expand Down
Loading