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

Dockerfiles no longer use Gradle-based Docker images for build #501

Merged
merged 11 commits into from
Jan 26, 2024
17 changes: 11 additions & 6 deletions docker/jdk11/Dockerfile.arm64
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,19 @@
########################################################################################
# Stage 1 : build the app
########################################################################################
FROM gradle:7.2.0-jdk11-openj9@sha256:68d2abb7a3dafef89b9f387095ebe2f7059dca48c53d83fd9328bf5914ce14a6 AS BUILD_JAR_STAGE

ENV GRADLE_USER_HOME=/home/gradle
WORKDIR $GRADLE_USER_HOME
# https://hub.docker.com/r/azul/zulu-openjdk-alpine
FROM azul/zulu-openjdk-alpine:11.0.21-11.68@sha256:f8e894209815cea08275c114b23274128eeba629fdfd792be4b3b5bdaf065dc8 AS BUILD_JAR_STAGE

ARG REVISION=master
ARG APP_BUILD_HOME=/root/app

WORKDIR $APP_BUILD_HOME

# Install Git and OpenSSH client on Alpine Linux
RUN apk --no-cache add openssh-client git && git --version

# Used to prune Docker cascaded layer cache if the sha256 of 'conf/gradle/dependencies.gradle' has changed
# Used to prune Docker cascaded layer cache if the sha256 of 'conf/gradle/dependencies.gradle' has changed, see .circleci/config.yml
ARG CACHE_BUSTER=1

# Build from the latest tag
Expand Down Expand Up @@ -58,8 +63,8 @@ RUN addgroup --system --gid $GROUP_ID stubby4j && \

WORKDIR "$STUBBY4J_USER_HOME"

COPY --from=BUILD_JAR_STAGE /home/gradle/stubby4j/build/libs/stubby4j*SNAPSHOT.jar ./stubby4j.jar
COPY --from=BUILD_JAR_STAGE /home/gradle/stubby4j/docker/log4j2-for-docker.xml ./log4j2.xml
COPY --from=BUILD_JAR_STAGE /root/app/stubby4j/build/libs/stubby4j*SNAPSHOT.jar ./stubby4j.jar
COPY --from=BUILD_JAR_STAGE /root/app/stubby4j/docker/log4j2-for-docker.xml ./log4j2.xml
RUN chown $USER_ID:$GROUP_ID stubby4j.jar && \
chown $USER_ID:$GROUP_ID log4j2.xml && \
java -version && \
Expand Down
20 changes: 12 additions & 8 deletions docker/jdk17/Dockerfile.arm64
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,21 @@
########################################################################################
# Stage 1 : build the app
########################################################################################
FROM gradle:7.2.0-jdk17@sha256:e9e90cc97b29423dda5a2ff5ed7787a31ab7f43660bd83993a880e33e1504c7b AS BUILD_JAR_STAGE

ENV GRADLE_USER_HOME=/home/gradle
WORKDIR $GRADLE_USER_HOME
# https://hub.docker.com/r/azul/zulu-openjdk-alpine
FROM azul/zulu-openjdk-alpine:17.0.9-17.46@sha256:80ba9a499e493d8cde618eafbe3fc8ef83f66494f02cdb1b9a91fcf38dd57f60 AS BUILD_JAR_STAGE

ARG REVISION=master
ARG APP_BUILD_HOME=/root/app

WORKDIR $APP_BUILD_HOME

# Install Git and OpenSSH client on Alpine Linux
RUN apk --no-cache add openssh-client git && git --version

# Used to prune Docker cascaded layer cache if the sha256 of 'conf/gradle/dependencies.gradle' has changed
# Used to prune Docker cascaded layer cache if the sha256 of 'conf/gradle/dependencies.gradle' has changed, see .circleci/config.yml
ARG CACHE_BUSTER=1

# Build from the latest tag
# Build from the latest tag.
RUN git clone --depth 1 --branch $REVISION https://github.com/azagniotov/stubby4j.git && \
cd stubby4j && \
./gradlew -Plog4j -PuseNativeJdkAlpnProcessor clean jar
Expand Down Expand Up @@ -58,8 +62,8 @@ RUN addgroup --system --gid $GROUP_ID stubby4j && \

WORKDIR "$STUBBY4J_USER_HOME"

COPY --from=BUILD_JAR_STAGE /home/gradle/stubby4j/build/libs/stubby4j*SNAPSHOT.jar ./stubby4j.jar
COPY --from=BUILD_JAR_STAGE /home/gradle/stubby4j/docker/log4j2-for-docker.xml ./log4j2.xml
COPY --from=BUILD_JAR_STAGE /root/app/stubby4j/build/libs/stubby4j*SNAPSHOT.jar ./stubby4j.jar
COPY --from=BUILD_JAR_STAGE /root/app/stubby4j/docker/log4j2-for-docker.xml ./log4j2.xml
RUN chown $USER_ID:$GROUP_ID stubby4j.jar && \
chown $USER_ID:$GROUP_ID log4j2.xml && \
java -version && \
Expand Down
23 changes: 14 additions & 9 deletions docker/jdk21/Dockerfile.arm64
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# A few useful Docker commands to build an image and run the stubby4j container.
# Please note: in order to build a JDK 21 Docker image, the REVISION must be "master". The JDK 21 is not supported in prior releases of stubby4j
#
# Build (run with '--no-cache' to ensure that Git repo new tags will be pulled down, as Docker caches RUNs):
# '$ docker build --build-arg REVISION=v7.2.0 --rm --no-cache -t stubby4j:latest .' or
# '$ docker build --build-arg REVISION=master --rm --no-cache -t stubby4j:latest .' or
# '$ docker build --rm --no-cache -t stubby4j:latest .' to build from master
#
# Run:
Expand All @@ -10,17 +11,21 @@
########################################################################################
# Stage 1 : build the app
########################################################################################
FROM gradle:8.5.0-jdk21@sha256:fb2c300486dcbd464f87152a75eb9f4605ae302f1ab7ab836b53f8a1c8f592f9 AS BUILD_JAR_STAGE

ENV GRADLE_USER_HOME=/home/gradle
WORKDIR $GRADLE_USER_HOME
# https://hub.docker.com/r/azul/zulu-openjdk-alpine
FROM azul/zulu-openjdk-alpine:21.0.1@sha256:06b72cb702413eff2f373d2fb36921f35c193cd756cc13ea10bc49adc8438921 AS BUILD_JAR_STAGE

ARG REVISION=master
ARG APP_BUILD_HOME=/root/app

WORKDIR $APP_BUILD_HOME

# Install Git and OpenSSH client on Alpine Linux
RUN apk --no-cache add openssh-client git && git --version

# Used to prune Docker cascaded layer cache if the sha256 of 'conf/gradle/dependencies.gradle' has changed
# Used to prune Docker cascaded layer cache if the sha256 of 'conf/gradle/dependencies.gradle' has changed, see .circleci/config.yml
ARG CACHE_BUSTER=1

# Build from the latest tag. The -PciRun will disable Spoteless Gradle plugin for JDK 21
# Build from the latest tag. Passing in the -PciRun will disable Spoteless Gradle plugin for JDK 21
RUN git clone --depth 1 --branch $REVISION https://github.com/azagniotov/stubby4j.git && \
cd stubby4j && \
./gradlew -PciRun -Plog4j -PuseNativeJdkAlpnProcessor clean jar
Expand Down Expand Up @@ -58,8 +63,8 @@ RUN addgroup --system --gid $GROUP_ID stubby4j && \

WORKDIR "$STUBBY4J_USER_HOME"

COPY --from=BUILD_JAR_STAGE /home/gradle/stubby4j/build/libs/stubby4j*SNAPSHOT.jar ./stubby4j.jar
COPY --from=BUILD_JAR_STAGE /home/gradle/stubby4j/docker/log4j2-for-docker.xml ./log4j2.xml
COPY --from=BUILD_JAR_STAGE /root/app/stubby4j/build/libs/stubby4j*SNAPSHOT.jar ./stubby4j.jar
COPY --from=BUILD_JAR_STAGE /root/app/stubby4j/docker/log4j2-for-docker.xml ./log4j2.xml
RUN chown $USER_ID:$GROUP_ID stubby4j.jar && \
chown $USER_ID:$GROUP_ID log4j2.xml && \
java -version && \
Expand Down
18 changes: 11 additions & 7 deletions docker/jdk8/Dockerfile.arm64
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,18 @@
########################################################################################
# Stage 1 : build the app
########################################################################################
FROM gradle:7.2.0-jdk8-openj9@sha256:18fdc03987ce333918cf2badfcb677d27ac1ca667b014eef32ba77b48e58ab83 AS BUILD_JAR_STAGE

ENV GRADLE_USER_HOME=/home/gradle
WORKDIR $GRADLE_USER_HOME
# https://hub.docker.com/r/azul/zulu-openjdk-alpine
FROM azul/zulu-openjdk-alpine:8u392-8.74@sha256:29b47f4af641f2a46fc9b1870b5a63dd15ffdb8625e3d7efca33790652d8f5ce AS BUILD_JAR_STAGE

ARG REVISION=master
ARG APP_BUILD_HOME=/root/app

WORKDIR $APP_BUILD_HOME

# Install Git and OpenSSH client on Alpine Linux
RUN apk --no-cache add openssh-client git && git --version

# Used to prune Docker cascaded layer cache if the sha256 of 'conf/gradle/dependencies.gradle' has changed
# Used to prune Docker cascaded layer cache if the sha256 of 'conf/gradle/dependencies.gradle' has changed, see .circleci/config.yml
ARG CACHE_BUSTER=1

# Build from the latest tag
Expand Down Expand Up @@ -58,8 +62,8 @@ RUN addgroup --system --gid $GROUP_ID stubby4j && \

WORKDIR "$STUBBY4J_USER_HOME"

COPY --from=BUILD_JAR_STAGE /home/gradle/stubby4j/build/libs/stubby4j*SNAPSHOT.jar ./stubby4j.jar
COPY --from=BUILD_JAR_STAGE /home/gradle/stubby4j/docker/log4j2-for-docker.xml ./log4j2.xml
COPY --from=BUILD_JAR_STAGE /root/app/stubby4j/build/libs/stubby4j*SNAPSHOT.jar ./stubby4j.jar
COPY --from=BUILD_JAR_STAGE /root/app/stubby4j/docker/log4j2-for-docker.xml ./log4j2.xml
RUN chown $USER_ID:$GROUP_ID stubby4j.jar && \
chown $USER_ID:$GROUP_ID log4j2.xml && \
java -version && \
Expand Down