This repository has been archived by the owner on Dec 18, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add application user to the Dockerfile
- Loading branch information
Showing
1 changed file
with
18 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |