Skip to content
This repository has been archived by the owner on Dec 18, 2023. It is now read-only.

Commit

Permalink
Add application user to the Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
ewelinagr committed May 6, 2019
1 parent 64a2e92 commit 9abf526
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,29 @@
FROM openjdk:8-jre-alpine

ENV APP_PORT=8083
ENV GB_BACKEND_VERSION=0.4.0-RC1
ENV GB_BACKEND_WAR_URL=https://repo.thehyve.nl/content/repositories/releases/nl/thehyve/gb-backend/${GB_BACKEND_VERSION}/gb-backend-${GB_BACKEND_VERSION}.war
ENV APP_PORT 8083
ENV GB_BACKEND_VERSION 0.4.0-RC1
ENV GB_BACKEND_WAR_URL https://repo.thehyve.nl/content/repositories/releases/nl/thehyve/gb-backend/${GB_BACKEND_VERSION}/gb-backend-${GB_BACKEND_VERSION}.war

# non-overridable environment variables
ENV APP_CONFIG_DIR=gb-backend.config.yml
ENV APP_USR gb_backend_usr
ENV APP_USR_HOME "/home/${APP_USR}"
ENV APP_CONFIG_FILE gb-backend.config.yml

COPY entrypoint.sh /entrypoint.sh

# download the war
RUN wget "${GB_BACKEND_WAR_URL}" -O "gb-backend-${GB_BACKEND_VERSION}.war" && \
EXPOSE ${APP_PORT}

USER root

RUN adduser -h "${APP_USR_HOME}" -D ${APP_USR} && \
sed -i 's/\r//' /entrypoint.sh && \
chmod +x /entrypoint.sh
chown "${APP_USR}" /entrypoint.sh && \
chmod u+x /entrypoint.sh

EXPOSE ${APP_PORT}
# download the war
RUN wget "${GB_BACKEND_WAR_URL}" -O "${APP_USR_HOME}/gb-backend-${GB_BACKEND_VERSION}.war"

USER ${APP_USR}
WORKDIR ${APP_USR_HOME}

ENTRYPOINT ["/entrypoint.sh"]

0 comments on commit 9abf526

Please sign in to comment.