From fa8d75af2aa20a307125e2bbbbcba40ce55dd5bc Mon Sep 17 00:00:00 2001 From: chrisgresty Date: Wed, 19 Feb 2020 18:10:38 +0000 Subject: [PATCH] Docker publish preparation (#630) --- docker/styx-image/Dockerfile | 20 +++++++++++++++----- docker/styx-image/styx-env.sh | 4 ++-- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/docker/styx-image/Dockerfile b/docker/styx-image/Dockerfile index 4c99118538..bf5380a125 100644 --- a/docker/styx-image/Dockerfile +++ b/docker/styx-image/Dockerfile @@ -7,22 +7,32 @@ ARG STYX_IMAGE=https://github.com/HotelsDotCom/styx/releases/download/${STYX_VER ENV APP_HOME=/styx ENV STYX_CONFIG=/styx/default-config/default.yml -ENV STYX_LOG_CONFIG=/styx/styx/conf/logback.xml +ENV STYX_LOG_CONFIG=/styx/conf/logback.xml ENV STYX_ENV_FILE=/styx/default-config/styx-env.sh ENV STYX_LOG_OUTPUT=/styx/logs/ +RUN addgroup styx && useradd -d /home/styx -g styx -s /bin/bash styx + +# Remove overriding ulimits +RUN rm -f /etc/security/limits.d/* + +ADD ${STYX_IMAGE} /styx.zip +RUN unzip /styx.zip \ + && rm /styx.zip + WORKDIR ${APP_HOME} -ADD ${STYX_IMAGE} ${APP_HOME}/styx.zip ADD default-docker.yml /styx/default-config/default.yml ADD styx-env.sh /styx/default-config/styx-env.sh ADD origins.yml /styx/default-config/origins.yml -RUN unzip styx.zip \ - && rm styx.zip +RUN mkdir -p ${STYX_LOG_OUTPUT} +RUN chown styx:styx ${STYX_LOG_OUTPUT} EXPOSE 8080 8443 9000 +USER styx + CMD ["/styx/default-config/default.yml"] -ENTRYPOINT ["styx/bin/startup"] +ENTRYPOINT ["bin/startup"] diff --git a/docker/styx-image/styx-env.sh b/docker/styx-image/styx-env.sh index 94d31dbf37..742ba59838 100644 --- a/docker/styx-image/styx-env.sh +++ b/docker/styx-image/styx-env.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash # -# Copyright (C) 2013-2019 Expedia Inc. +# Copyright (C) 2013-2020 Expedia Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -22,7 +22,7 @@ JVM_DIRECT_MEMORY="${JVM_DIRECT_MEMORY:=-XX:MaxDirectMemorySize=512m}" JVM_HEAP_OPTS="${JVM_HEAP_OPTS:=-XX:+AlwaysPreTouch}" -JVM_GC_LOG="${JVM_GC_LOG:=-XX:+PrintGCDetails -Xloggc:/styx/logs/gc.log.$(/bin/date +%Y-%m-%d-%H%M%S)}" +JVM_GC_LOG="${JVM_GC_LOG:=-XX:+PrintGCDetails -Xloggc:${APP_HOME}/logs/gc.log.$(/bin/date +%Y-%m-%d-%H%M%S)}" JVM_HEAP_DUMP="${JVM_HEAP_DUMP:=-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/var/tmp}" # Set java VM type