Change entrypoint of dockerfile.

Use environment variables for base_uri and config file.
This commit is contained in:
sfigato 2019-09-04 12:36:01 +02:00 committed by blallo
parent c1bcd47220
commit fae15e5737
Signed by: blallo
GPG Key ID: 0CBE577C9B72DC3F
3 changed files with 38 additions and 2 deletions

View File

@ -1,2 +1,4 @@
/dist/* /dist/*
/bot.z_web/node_modules/* /bot.z_web/node_modules/*
/.*yaml
/.*yml

View File

@ -11,6 +11,7 @@ COPY --from=node /opt /opt
COPY --from=ff /opt/firefox-latest /opt/firefox-latest COPY --from=ff /opt/firefox-latest /opt/firefox-latest
COPY --from=ff /opt/geckodriver* /opt/ COPY --from=ff /opt/geckodriver* /opt/
COPY . /app COPY . /app
COPY entrypoint.sh /srv/
WORKDIR /app/bot.z_web WORKDIR /app/bot.z_web
RUN apt-get update \ RUN apt-get update \
&& apt-get install -y $(apt-cache depends firefox-esr| awk '/Depends:/{print$2}') \ && apt-get install -y $(apt-cache depends firefox-esr| awk '/Depends:/{print$2}') \
@ -27,5 +28,4 @@ RUN python setup.py develop
EXPOSE 3003 EXPOSE 3003
VOLUME ["/app/bot.z_web/node_modules"] VOLUME ["/app/bot.z_web/node_modules"]
ENTRYPOINT ["z_app"] ENTRYPOINT ["/srv/entrypoint.sh"]
CMD ["-a", "0.0.0.0"]

34
entrypoint.sh Executable file
View File

@ -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}