diff --git a/.dockerignore b/.dockerignore index 8cdc7b4..d274de1 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,2 +1,4 @@ /dist/* /bot.z_web/node_modules/* +/.*yaml +/.*yml diff --git a/Dockerfile b/Dockerfile index eb4e3d2..701280b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,6 +11,7 @@ COPY --from=node /opt /opt COPY --from=ff /opt/firefox-latest /opt/firefox-latest COPY --from=ff /opt/geckodriver* /opt/ COPY . /app +COPY entrypoint.sh /srv/ WORKDIR /app/bot.z_web RUN apt-get update \ && apt-get install -y $(apt-cache depends firefox-esr| awk '/Depends:/{print$2}') \ @@ -27,5 +28,4 @@ RUN python setup.py develop EXPOSE 3003 VOLUME ["/app/bot.z_web/node_modules"] -ENTRYPOINT ["z_app"] -CMD ["-a", "0.0.0.0"] +ENTRYPOINT ["/srv/entrypoint.sh"] diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100755 index 0000000..00b433f --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +CONF="/tmp/botz.yaml" + +if [ -z ${DEBUG} ]; then + _DEBUG="false" +else + _DEBUG="true" +fi + +if [ -z ${BASE_URI} ]; then + echo "Missing BASE_URI environment variable." + exit 1 +fi + +cat > ${CONF} <<-EOF +base_uri: ${BASE_URI} +debug: ${_DEBUG} +log: + level: ${DEBUG_LEVEL:-INFO} + syslog: false +http: + bind_addr: + - "0.0.0.0" + port: 3003 +EOF + +echo "--------------------------------------------" +echo " STARTING WITH CONFIG:" +echo "--------------------------------------------" +cat ${CONF} +echo "--------------------------------------------" + +z_app -c ${CONF}