Stavros Kanarakis | 22025d4 | 2020-02-28 21:53:04 +0200 | [diff] [blame] | 1 | FROM openjdk:11-jre-slim |
Stavros Kanarakis | f6668af | 2019-04-22 18:41:18 +0300 | [diff] [blame] | 2 | |
| 3 | ARG PROJECT_BUILD_DIR_NAME |
| 4 | ARG FINAL_JAR |
| 5 | ARG DEPENDENCIES_DIR |
| 6 | ARG DOCKER_ARTIFACT_DIR |
| 7 | |
| 8 | #Add a new user and group to allow container to be run as non-root |
Stavros Kanarakis | 22025d4 | 2020-02-28 21:53:04 +0200 | [diff] [blame] | 9 | RUN addgroup --system bbs-ep && adduser --system --ingroup bbs-ep bbs-ep |
Stavros Kanarakis | f6668af | 2019-04-22 18:41:18 +0300 | [diff] [blame] | 10 | |
| 11 | #Copy dependencies and executable jar |
| 12 | WORKDIR ${DOCKER_ARTIFACT_DIR} |
| 13 | COPY ${PROJECT_BUILD_DIR_NAME}/${FINAL_JAR} . |
Stavros Kanarakis | 22025d4 | 2020-02-28 21:53:04 +0200 | [diff] [blame] | 14 | COPY KeyStore.jks . |
| 15 | COPY KeyStorePass.txt . |
| 16 | |
Stavros Kanarakis | f6668af | 2019-04-22 18:41:18 +0300 | [diff] [blame] | 17 | #Overcome Docker limitation to put ARG inside ENTRYPOINT |
| 18 | RUN ln -s ${FINAL_JAR} bbs-ep.jar |
| 19 | COPY ${PROJECT_BUILD_DIR_NAME}/${DEPENDENCIES_DIR} ./${DEPENDENCIES_DIR} |
| 20 | |
| 21 | EXPOSE 8100 |
| 22 | |
| 23 | USER bbs-ep:bbs-ep |
| 24 | ENTRYPOINT ["java", "-jar", "bbs-ep.jar"] |