Skip to content

Commit

Permalink
chore: use alpine in Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
NilsOveTen committed Dec 19, 2023
1 parent bc26eb9 commit baa79c7
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
FROM openjdk:17-slim
FROM eclipse-temurin:17-jre-alpine

ARG USER=default
ENV HOME /home/$USER

ENV TZ=Europe/Oslo
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

VOLUME /tmp
COPY /target/app.jar app.jar
# install sudo as root
RUN apk add --update sudo

RUN adduser -D $USER \
&& echo "$USER ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/$USER \
&& chmod 0440 /etc/sudoers.d/$USER

USER $USER
WORKDIR $HOME

COPY --chown=app:app /target/app.jar app.jar

CMD java -jar -XX:+UseZGC $JAVA_OPTS app.jar

0 comments on commit baa79c7

Please sign in to comment.