Commit 467730ee authored by Lückemeyer's avatar Lückemeyer
Browse files

externalized user and group config from docker image build, config with env...

externalized user and group config from docker image build, config with env USER and GID (of docker group) or build-args AUSER and AGID (of docker group)
parent b01679f1
Pipeline #8663 passed with stage
...@@ -25,22 +25,23 @@ ENV SPRING_CONFIG_ADDITIONAL_LOCATION "file:/data/config/" ...@@ -25,22 +25,23 @@ ENV SPRING_CONFIG_ADDITIONAL_LOCATION "file:/data/config/"
COPY --from=corretto-jdk /customjre $JAVA_HOME COPY --from=corretto-jdk /customjre $JAVA_HOME
# Add app user # Add app user
ARG APPLICATION_USER=appuser ARG AUSER=appuser
RUN addgroup -g 137 -S docker ARG AGID=137
RUN adduser --no-create-home -u 1000 -G docker -D $APPLICATION_USER ENV USER=$AUSER
ENV GID=$AGID
RUN addgroup -g $GID -S docker
RUN adduser --no-create-home -u 1000 -G docker -D $USER
# Prepare environment. # Prepare environment.
# Create needed folders # Create needed folders
RUN mkdir /data && \ RUN mkdir /data && \
mkdir /data/config && \ mkdir /data/config && \
chown -R $APPLICATION_USER /data chown -R $USER /data
EXPOSE 8080
VOLUME /data VOLUME /data
COPY --chown=1000:1000 target/dta-backend.jar app.jar COPY --chown=1000:$GID target/dta-backend.jar app.jar
USER 1000 USER 1000:$GID
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"] ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment