Skip to content

Commit

Permalink
chore: update java version (#32)
Browse files Browse the repository at this point in the history
* chore: update java version

* pin container base image

* remove unnecessary file

* externalize base image

* fix base image
  • Loading branch information
ravisingal authored Jul 26, 2024
1 parent e4976d2 commit 467c48c
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 22 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/pr-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ jobs:
shell: bash
id: versions
run: |
ZULU_JDK_VERSION=`cat java-${{ matrix.java-major-version}}/java.version`
ZULU_JDK_VERSION=$(cat java-${{ matrix.java-major-version}}/java.version | tr -d "\n")
echo ZULU_JDK_VERSION=${ZULU_JDK_VERSION} >> $GITHUB_OUTPUT
BASE_IMAGE=$(cat java-${{ matrix.java-major-version}}/base.image | tr -d "\n")
echo BASE_IMAGE=${BASE_IMAGE} >> $GITHUB_OUTPUT
- name: Build java-${{ matrix.java-major-version}}
uses: docker/build-push-action@v5
Expand All @@ -42,6 +44,7 @@ jobs:
platforms: ${{ matrix.platform }}
build-args: |
JAVA_VERSION=${{ steps.versions.outputs.ZULU_JDK_VERSION }}
BASE_IMAGE=${{ steps.versions.outputs.BASE_IMAGE }}
tags: hypertrace/java-build:${{ matrix.java-major-version}}
load: true

Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,12 @@ jobs:
shell: bash
id: versions
run: |
ZULU_JDK_VERSION=`cat java-${{ matrix.java-major-version}}/java.version`
ZULU_JDK_VERSION=$(cat java-${{ matrix.java-major-version}}/java.version | tr -d "\n")
echo ZULU_JDK_VERSION=${ZULU_JDK_VERSION} >> $GITHUB_OUTPUT
echo JAVA_MAJOR_VERSION=$(echo $ZULU_JDK_VERSION | cut -d'.' -f1) >> $GITHUB_OUTPUT
echo JAVA_FULL_VERSION=$(echo $ZULU_JDK_VERSION | cut -d'-' -f1) >> $GITHUB_OUTPUT
BASE_IMAGE=$(cat java-${{ matrix.java-major-version}}/base.image | tr -d "\n")
echo BASE_IMAGE=${BASE_IMAGE} >> $GITHUB_OUTPUT
- name: Publish Java ${{ matrix.java-major-version}} image
uses: docker/build-push-action@v5
Expand All @@ -44,5 +46,6 @@ jobs:
platforms: linux/amd64,linux/arm64
build-args: |
JAVA_VERSION=${{ steps.versions.outputs.ZULU_JDK_VERSION }}
BASE_IMAGE=${{ steps.versions.outputs.BASE_IMAGE }}
tags: hypertrace/java:${{ steps.versions.outputs.JAVA_MAJOR_VERSION }},hypertrace/java:${{ steps.versions.outputs.JAVA_FULL_VERSION }}
push: true
17 changes: 8 additions & 9 deletions java-11/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
ARG JAVA_VERSION
ARG BASE_IMAGE
FROM azul/zulu-openjdk-debian:${JAVA_VERSION} AS jre

# Needed for --strip-debug
Expand Down Expand Up @@ -50,26 +51,26 @@ FROM debian:bookworm-slim As builder
RUN apt update && apt install -y libjemalloc-dev

# stage for amd64
FROM gcr.io/distroless/cc-debian12:debug AS base-amd64
FROM ${BASE_IMAGE} AS base-amd64

SHELL ["/busybox/sh", "-c"]
RUN ln -s /busybox/sh /bin/sh

COPY --from=jre /lib/x86_64-linux-gnu/libz.so.1.2.11 /lib/x86_64-linux-gnu/libz.so.1.2.11
RUN ln -s /lib/x86_64-linux-gnu/libz.so.1.2.11 /lib/x86_64-linux-gnu/libz.so.1
COPY --from=jre /lib/x86_64-linux-gnu/libz.so.1.2.13 /lib/x86_64-linux-gnu/libz.so.1.2.13
RUN ln -s /lib/x86_64-linux-gnu/libz.so.1.2.13 /lib/x86_64-linux-gnu/libz.so.1

# change default memory allocator to jemalloc
COPY --from=builder /usr/lib/x86_64-linux-gnu/libjemalloc* /usr/lib/x86_64-linux-gnu/
ENV LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so

# stage for arm64
FROM gcr.io/distroless/cc-debian12:debug AS base-arm64
FROM ${BASE_IMAGE} AS base-arm64

SHELL ["/busybox/sh", "-c"]
RUN ln -s /busybox/sh /bin/sh

COPY --from=jre /lib/aarch64-linux-gnu/libz.so.1.2.11 /lib/aarch64-linux-gnu/libz.so.1.2.11
RUN ln -s /lib/aarch64-linux-gnu/libz.so.1.2.11 /lib/aarch64-linux-gnu/libz.so.1
COPY --from=jre /lib/aarch64-linux-gnu/libz.so.1.2.13 /lib/aarch64-linux-gnu/libz.so.1.2.13
RUN ln -s /lib/aarch64-linux-gnu/libz.so.1.2.13 /lib/aarch64-linux-gnu/libz.so.1

# change default memory allocator to jemalloc
COPY --from=builder /usr/lib/aarch64-linux-gnu/libjemalloc* /usr/lib/aarch64-linux-gnu/
Expand All @@ -79,11 +80,9 @@ ENV LD_PRELOAD=/usr/lib/aarch64-linux-gnu/libjemalloc.so
ARG TARGETARCH
FROM base-${TARGETARCH}

MAINTAINER Hypertrace "https://www.hypertrace.org/"

COPY --from=ssl /etc/ssl/certs/java /etc/ssl/certs/java

COPY --from=jre /jre /usr/lib/jvm/zulu-11-slim

RUN ln -s /usr/lib/jvm/zulu-11-slim/bin/java /usr/bin/java
RUN ln -s /usr/lib/jvm/zulu-11-slim/bin/jfr /usr/bin/jfr

Expand Down
1 change: 1 addition & 0 deletions java-11/base.image
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
gcr.io/distroless/cc-debian12:debug@sha256:133c2e182e87c72c5efff9a3743f31542841425e9810b4a8371a9b95e06d1bd7
2 changes: 1 addition & 1 deletion java-11/java.version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
11.0.23-11.72
11.0.24-11.74
17 changes: 8 additions & 9 deletions java-21/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
ARG JAVA_VERSION
ARG BASE_IMAGE
FROM azul/zulu-openjdk-debian:${JAVA_VERSION} AS jre

# Needed for --strip-debug
Expand Down Expand Up @@ -50,26 +51,26 @@ FROM debian:bookworm-slim AS builder
RUN apt update && apt install -y libjemalloc-dev

# stage for amd64
FROM gcr.io/distroless/cc-debian12:debug AS base-amd64
FROM ${BASE_IMAGE} AS base-amd64

SHELL ["/busybox/sh", "-c"]
RUN ln -s /busybox/sh /bin/sh

COPY --from=jre /lib/x86_64-linux-gnu/libz.so.1.2.11 /lib/x86_64-linux-gnu/libz.so.1.2.11
RUN ln -s /lib/x86_64-linux-gnu/libz.so.1.2.11 /lib/x86_64-linux-gnu/libz.so.1
COPY --from=jre /lib/x86_64-linux-gnu/libz.so.1.2.13 /lib/x86_64-linux-gnu/libz.so.1.2.13
RUN ln -s /lib/x86_64-linux-gnu/libz.so.1.2.13 /lib/x86_64-linux-gnu/libz.so.1

# change default memory allocator to jemalloc
COPY --from=builder /usr/lib/x86_64-linux-gnu/libjemalloc* /usr/lib/x86_64-linux-gnu/
ENV LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so

# stage for arm64
FROM gcr.io/distroless/cc-debian12:debug AS base-arm64
FROM ${BASE_IMAGE} AS base-arm64

SHELL ["/busybox/sh", "-c"]
RUN ln -s /busybox/sh /bin/sh

COPY --from=jre /lib/aarch64-linux-gnu/libz.so.1.2.11 /lib/aarch64-linux-gnu/libz.so.1.2.11
RUN ln -s /lib/aarch64-linux-gnu/libz.so.1.2.11 /lib/aarch64-linux-gnu/libz.so.1
COPY --from=jre /lib/aarch64-linux-gnu/libz.so.1.2.13 /lib/aarch64-linux-gnu/libz.so.1.2.13
RUN ln -s /lib/aarch64-linux-gnu/libz.so.1.2.13 /lib/aarch64-linux-gnu/libz.so.1

# change default memory allocator to jemalloc
COPY --from=builder /usr/lib/aarch64-linux-gnu/libjemalloc* /usr/lib/aarch64-linux-gnu/
Expand All @@ -79,11 +80,9 @@ ENV LD_PRELOAD=/usr/lib/aarch64-linux-gnu/libjemalloc.so
ARG TARGETARCH
FROM base-${TARGETARCH}

MAINTAINER Hypertrace "https://www.hypertrace.org/"

COPY --from=ssl /etc/ssl/certs/java /etc/ssl/certs/java

COPY --from=jre /jre /usr/lib/jvm/zulu-21-slim

RUN ln -s /usr/lib/jvm/zulu-21-slim/bin/java /usr/bin/java
RUN ln -s /usr/lib/jvm/zulu-21-slim/bin/jfr /usr/bin/jfr

Expand Down
1 change: 1 addition & 0 deletions java-21/base.image
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
gcr.io/distroless/cc-debian12:debug@sha256:133c2e182e87c72c5efff9a3743f31542841425e9810b4a8371a9b95e06d1bd7
2 changes: 1 addition & 1 deletion java-21/java.version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
21.0.3-21.34
21.0.4-21.36

0 comments on commit 467c48c

Please sign in to comment.