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

Issue90 #91

Merged
merged 4 commits into from
Oct 26, 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
1 change: 1 addition & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ publish() {
echo "Building Docker image with version $VERSION"
docker build -t $IMAGE_NAME:$VERSION -t $IMAGE_NAME:latest -f ./docker/Dockerfile . --no-cache=true
docker build -t $IMAGE_NAME:$VERSION-slim -f ./docker/Dockerfile-Slim . --no-cache=true
dokcer build -t $IMAGE_NAME:$VERSION-17 -f ./docker/Dockerfile.17 . --no-cache=true
echo "Images built with version $VERSION"
echo "Pushing image to DockerHub"
docker push $IMAGE_NAME -a
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ ENV PATH="$PATH:$JAVA_MINIMAL/bin"

COPY --from=packager "$JAVA_MINIMAL" "$JAVA_MINIMAL"
COPY /target/http-sidecar.jar server.jar
CMD ["/bin/sh","-c","java -Dlight-4j-config-dir=/config -Dlogback.configurationFile=/config/logback.xml -jar /server.jar"]
CMD ["/bin/sh","-c","exec java -Dlight-4j-config-dir=/config -Dlogback.configurationFile=/config/logback.xml -jar /server.jar"]
2 changes: 1 addition & 1 deletion docker/Dockerfile-Debug
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
FROM openjdk:11.0.3-slim
ADD /target/light-proxy.jar server.jar
CMD ["/bin/sh","-c","java -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005 -Dlight-4j-config-dir=/config -Dlogback.configurationFile=/config/logback.xml -jar /server.jar"]
CMD ["/bin/sh","-c","exec java -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005 -Dlight-4j-config-dir=/config -Dlogback.configurationFile=/config/logback.xml -jar /server.jar"]
2 changes: 1 addition & 1 deletion docker/Dockerfile-Slim
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
FROM openjdk:11.0.3-slim
ADD /target/http-sidecar.jar server.jar
CMD ["/bin/sh","-c","java -Dlight-4j-config-dir=/config -Dlogback.configurationFile=/config/logback.xml -jar /server.jar"]
CMD ["/bin/sh","-c","exec java -Dlight-4j-config-dir=/config -Dlogback.configurationFile=/config/logback.xml -jar /server.jar"]
46 changes: 46 additions & 0 deletions docker/Dockerfile.17
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
FROM amazoncorretto:17-alpine as corretto-jdk

RUN { \
java --version ; \
echo "jlink version:" && \
$JAVA_HOME/bin/jlink --version ; \
}

# required for strip-debug to work
RUN apk add --no-cache binutils

# build modules distribution
RUN $JAVA_HOME/bin/jlink \
--verbose \
--add-modules \
java.base,java.sql,java.naming,java.desktop,java.xml,jdk.crypto.cryptoki,jdk.crypto.ec,jdk.unsupported,java.management,java.security.jgss,java.net.http,java.net.http \
--compress 2 \
--strip-debug \
--no-header-files \
--no-man-pages \
--output /customjre

# Second stage, add only our minimal "JRE" distr and our app
FROM alpine

ENV JAVA_HOME=/jre
ENV PATH="${JAVA_HOME}/bin:${PATH}"

# copy JRE from the base image
COPY --from=corretto-jdk /customjre $JAVA_HOME

# Add app user
ARG APPLICATION_USER=appuser
RUN adduser --no-create-home -u 1000 -D $APPLICATION_USER

# Configure working directory
RUN mkdir /app && \
chown -R $APPLICATION_USER /app

USER 1000

COPY --chown=1000:1000 /target/http-sidecar.jar /app/server.jar

WORKDIR /app

CMD ["/bin/sh","-c","exec java -Dlight-4j-config-dir=/config -Dlogback.configurationFile=/config/logback.xml -jar /app/server.jar"]