From a511e05019b996df82a8c18d975a2fde04d17140 Mon Sep 17 00:00:00 2001 From: crusader Date: Wed, 9 Aug 2017 11:50:02 +0900 Subject: [PATCH] Docker --- Dockerfile | 20 ++++++++++++-------- docker/bin/docker-entrypoint.sh | 4 +--- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index cdb4343..06cd61d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,24 +1,28 @@ FROM openjdk:8-jdk-alpine MAINTAINER Loafle -ENV APP_FILENAME="com.loafle.overflow.overflow_server-1.0.0-SNAPSHOT.jar" +ENV APP_FILENAME="com.loafle.overflow.overflow_server-1.0.0-SNAPSHOT.jar" \ + APP_HOME_PATH="/service" \ + APP_MAIN_CLASS="com.loafle.overflow.OFMain" \ + PATH="$PATH:/opt/bin" ADD docker/bin/*.sh /opt/bin/ +ADD target/lib ${APP_HOME_PATH}/lib +ADD target/${APP_FILENAME} ${APP_HOME_PATH}/ RUN apk add --no-cache curl \ && chmod +x /opt/bin/*.sh -ADD target/lib /service/lib -ADD target/com.loafle.overflow.overflow_server-1.0.0-SNAPSHOT.jar /service/ - -ENV TINI_VERSION='0.14.0' \ - TINI_SHA='6c41ec7d33e857d4779f14d9c74924cab0c7973485d2972419a3b7c7620ff5fd' +ENV TINI_VERSION='0.15.0' \ + TINI_SHA='4007655082f573603c02bc1d2137443c8e153af047ffd088d02ccc01e6f06170' # Use tini as subreaper in Docker container to adopt zombie processes -RUN curl -fsSL https://github.com/krallin/tini/releases/download/v${TINI_VERSION}/tini-static-amd64 -o /bin/tini && chmod +x /bin/tini \ +RUN curl -fsSL https://github.com/krallin/tini/releases/download/v${TINI_VERSION}/tini-static-amd64 -o /bin/tini \ + && chmod +x /bin/tini \ && echo "$TINI_SHA /bin/tini" | sha256sum -c - EXPOSE 50006 -ENTRYPOINT ["/bin/tini", "--", "/opt/bin/docker-entrypoint.sh"] +ENTRYPOINT ["/bin/tini", "--"] +CMD ["docker-entrypoint.sh"] \ No newline at end of file diff --git a/docker/bin/docker-entrypoint.sh b/docker/bin/docker-entrypoint.sh index 7d068df..8bceabd 100644 --- a/docker/bin/docker-entrypoint.sh +++ b/docker/bin/docker-entrypoint.sh @@ -4,8 +4,6 @@ set -e cd /service -#/usr/bin/java -cp lib/*.jar -jar "com.loafle.overflow.overflow_server-1.0.0-SNAPSHOT.jar" 50006 - -/usr/bin/java -cp com.loafle.overflow.overflow_server-1.0.0-SNAPSHOT.jar:lib/* com.loafle.overflow.OFMain 50006 +/usr/bin/java -cp ${APP_FILENAME}:lib/* ${APP_MAIN_CLASS} 50006 exec "$@" \ No newline at end of file