An error occurred while loading the file. Please try again.
-
Lückemeyer authoredb294c18e
# base image to build a JRE
FROM amazoncorretto:17.0.3-alpine as corretto-jdk
# required for strip-debug to work
RUN apk add --no-cache binutils
# Build small JRE image
RUN $JAVA_HOME/bin/jlink \
--verbose \
--add-modules ALL-MODULE-PATH \
--strip-debug \
--no-man-pages \
--no-header-files \
--compress=2 \
--output /customjre
# main app image
FROM alpine:latest
ENV JAVA_HOME=/jre
ENV PATH="${JAVA_HOME}/bin:${PATH}"
ENV SPRING_CONFIG_ADDITIONAL_LOCATION "file:/data/config/"
# copy JRE from the base image
COPY --from=corretto-jdk /customjre $JAVA_HOME
# Add app user
ARG AUSER=appuser
ARG AGID=137
ENV USER=$AUSER
ENV GID=$AGID
ARG BUILD_NUMBER=
# Create docker group identical to host
RUN addgroup -g $GID -S docker
RUN adduser --no-create-home -u 1000 -G docker -D $USER
# Prepare environment.
# Create needed folders
RUN mkdir /data && \
mkdir /data/config && \
chown -R $USER /data
VOLUME /data
COPY --chown=1000:$GID target/dta-backend-$BUILD_NUMBER.jar app.jar
USER 1000:$GID
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]