Skip to content

Commit

Permalink
Merge pull request #1653 from gounthar/fixes-alpine-version
Browse files Browse the repository at this point in the history
feat(alpine): Pin Alpine version to 3.18.0
  • Loading branch information
dduportal committed Jun 14, 2023
2 parents a535948 + 04ceeb3 commit 07dd84b
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 14 deletions.
6 changes: 4 additions & 2 deletions 11/alpine/hotspot/Dockerfile
@@ -1,4 +1,6 @@
FROM eclipse-temurin:11.0.19_7-jdk-alpine AS jre-build
ARG JAVA_VERSION="11.0.19_7"
ARG ALPINE_TAG=3.18.0
FROM eclipse-temurin:"${JAVA_VERSION}"-jdk-alpine AS jre-build

# Generate smaller java runtime without unneeded files
# for now we include the full module path to maintain compatibility
Expand All @@ -11,7 +13,7 @@ RUN jlink \
--compress=2 \
--output /javaruntime

FROM alpine:3.18.0
FROM alpine:"${ALPINE_TAG}" AS build

RUN apk add --no-cache \
bash \
Expand Down
32 changes: 21 additions & 11 deletions 17/alpine/hotspot/Dockerfile
@@ -1,18 +1,28 @@
FROM eclipse-temurin:17.0.7_7-jdk-alpine AS jre-build
ARG JAVA_VERSION="17.0.7_7"
ARG ALPINE_TAG=3.18.0
FROM eclipse-temurin:"${JAVA_VERSION}"-jdk-alpine AS jre-build

# Generate smaller java runtime without unneeded files
# for now we include the full module path to maintain compatibility
# while still saving space (approx 200mb from the full distribution)
RUN apk add --no-cache binutils \
&& jlink \
--add-modules ALL-MODULE-PATH \
--strip-debug \
--no-man-pages \
--no-header-files \
--compress=2 \
--output /javaruntime

FROM alpine:3.18.0
RUN if [ "$TARGETPLATFORM" != 'linux/arm/v7' ]; then \
case "$(jlink --version 2>&1)" in \
# jlink version 11 has less features than JDK17+
"11."*) strip_java_debug_flags="--strip-debug" ;; \
*) strip_java_debug_flags="--strip-java-debug-attributes" ;; \
esac; \
jlink \
--add-modules ALL-MODULE-PATH \
"$strip_java_debug_flags" \
--no-man-pages \
--no-header-files \
--compress=2 \
--output /javaruntime; \
else \
cp -r /opt/java/openjdk /javaruntime; \
fi

FROM alpine:"${ALPINE_TAG}" AS build

RUN apk add --no-cache \
bash \
Expand Down
23 changes: 22 additions & 1 deletion docker-bake.hcl
Expand Up @@ -77,6 +77,21 @@ variable "COMMIT_SHA" {
default = ""
}

variable "ALPINE_FULL_TAG" {
default = "3.18.0"
}

variable "ALPINE_SHORT_TAG" {
default = regex_replace(ALPINE_FULL_TAG, "\\.\\d+$", "")
}

variable "JAVA11_VERSION" {
default = "11.0.19_7"
}

variable "JAVA17_VERSION" {
default = "17.0.7_7"
}
# ---- user-defined functions ----

# return a tag prefixed by the Jenkins version
Expand Down Expand Up @@ -142,14 +157,17 @@ target "alpine_jdk11" {
COMMIT_SHA = COMMIT_SHA
PLUGIN_CLI_VERSION = PLUGIN_CLI_VERSION
RELEASE_LINE = release_line()
ALPINE_TAG = ALPINE_FULL_TAG
JAVA_VERSION = JAVA11_VERSION
}
tags = [
tag(true, "alpine"),
tag_weekly(false, "alpine"),
tag_weekly(false, "alpine-jdk11"),
tag_weekly(false, "alpine${ALPINE_SHORT_TAG}-jdk11"),
tag_lts(false, "lts-alpine"),
tag_lts(false, "lts-alpine-jdk11"),
tag_lts(true, "lts-alpine"),
tag_lts(true, "lts-alpine")
]
platforms = ["linux/amd64"]
}
Expand All @@ -163,10 +181,13 @@ target "alpine_jdk17" {
COMMIT_SHA = COMMIT_SHA
PLUGIN_CLI_VERSION = PLUGIN_CLI_VERSION
RELEASE_LINE = release_line()
ALPINE_TAG = ALPINE_FULL_TAG
JAVA_VERSION = JAVA17_VERSION
}
tags = [
tag(true, "alpine-jdk17"),
tag_weekly(false, "alpine-jdk17"),
tag_weekly(false, "alpine${ALPINE_SHORT_TAG}-jdk17"),
tag_lts(false, "lts-alpine-jdk17")
]
platforms = ["linux/amd64"]
Expand Down

0 comments on commit 07dd84b

Please sign in to comment.