Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(alpine): Pin Alpine version to 3.18.0 #1653

Merged
merged 1 commit into from
Jun 14, 2023
Merged
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
6 changes: 4 additions & 2 deletions 11/alpine/hotspot/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,21 @@ variable "COMMIT_SHA" {
default = ""
}

variable "ALPINE_FULL_TAG" {
default = "3.18.0"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is dependabot able to update this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do hope so.

Copy link
Contributor

@dduportal dduportal Jun 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm interested if you find a solution for doing this with Dependabot?
As per dependabot/feedback#154, it does not seem it is possible.

I understand the goal here would be to use updatecli as it's already working on the agent images?
Btw, I've opened updatecli/updatecli#1378

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is the final goal for this PR, yes. 🤷
Thanks.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renovate should be able to do this as well without needing to add update cli:
https://docs.renovatebot.com/modules/manager/regex/

somewhat similar:
renovatebot/renovate#16439 (comment)

}

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