Skip to content

Commit

Permalink
Adds workaround for #34
Browse files Browse the repository at this point in the history
Signed-off-by: Adrian Cole <[email protected]>
  • Loading branch information
Adrian Cole committed Dec 5, 2023
1 parent 34d3b27 commit 831ce59
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
8 changes: 6 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ ARG docker_parent_image=ghcr.io/openzipkin/alpine:3.18.5
# When updating, also update the README
# * Use current version from https://pkgs.alpinelinux.org/packages?name=openjdk21, stripping
# the `-rX` at the end.
ARG java_version=21.0.1_p12
ARG java_version=17.0.9_p8
ARG java_home=/usr/lib/jvm/java-21-openjdk

# We copy files from the context into a scratch container first to avoid a problem where docker and
Expand Down Expand Up @@ -66,7 +66,11 @@ FROM jdk as install
WORKDIR /install

# Included modules cherry-picked from https://docs.oracle.com/en/java/javase/21/docs/api/
RUN jlink --vm=server --no-header-files --no-man-pages --compress=0 --strip-debug --add-modules \
# Note: unlike the master branch, this doesn't use --strip-debug on non-x86_64, because
# it fails like below on JDK17 per #34:
# Error: java.io.IOException: Cannot run program "objcopy": error=0, Failed to exec spawn helper: pid: 39, exit value: 1
RUN if [ -d "/usr/lib/jvm/java-17-openjdk" ] && uname -m | grep -E 'x86_64'; then strip="--strip-debug"; else strip=""; fi && \
jlink --vm=server --no-header-files --no-man-pages --compress=0 ${strip} --add-modules \
java.base,java.logging,\
# java.desktop includes java.beans which is used by Spring
java.desktop,\
Expand Down
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,27 @@ This is an internal base layer primarily used in [zipkin](https://github.com/ope

To try the image, run the `java -version` command:
```bash
docker run --rm ghcr.io/openzipkin/java:21.0.1_p12 -version
openjdk version "21.0.1" 2023-10-17
OpenJDK Runtime Environment (build 21.0.1+12-alpine-r0)
OpenJDK 64-Bit Server VM (build 21.0.1+12-alpine-r0, mixed mode, sharing)
docker run --rm ghcr.io/openzipkin/java:17.0.9_p8 -version
openjdk version "17.0.9" 2023-10-17
OpenJDK Runtime Environment (build 17.0.9+8-alpine-r0)
OpenJDK 64-Bit Server VM (build 17.0.9+8-alpine-r0, mixed mode, sharing)
```

## Release process
Build the `Dockerfile` using the current version without the revision classifier from here:
* https://pkgs.alpinelinux.org/packages?name=openjdk21
```bash
# Note 21.0.1_p12 not 21.0.1_p12-r0!
./build-bin/build 21.0.1_p12
# Note 17.0.9_p8 not 17.0.9_p8-r0!
./build-bin/build 17.0.9_p8
```

Next, verify the built image matches that version:
```bash
docker run --rm openzipkin/java:test -version
openjdk version "21.0.1" 2023-10-17
OpenJDK Runtime Environment (build 21.0.1+12-alpine-r0)
OpenJDK 64-Bit Server VM (build 21.0.1+12-alpine-r0, mixed mode, sharing)
openjdk version "17.0.9" 2023-10-17
OpenJDK Runtime Environment (build 17.0.9+8-alpine-r0)
OpenJDK 64-Bit Server VM (build 17.0.9+8-alpine-r0, mixed mode, sharing)
```

To release the image, push a tag matching the arg to `build-bin/build` (ex `21.0.1_p12`).
To release the image, push a tag matching the arg to `build-bin/build` (ex `17.0.9_p8`).
This triggers a [GitHub Actions](https://github.com/openzipkin/docker-java/actions) job to push the image.

0 comments on commit 831ce59

Please sign in to comment.