Dockerfile: add DEBUG environment flag

This checks environment variable DEBUG,, and if set will start the
daemons with "-d" instead of "-f".  We need the unquoted version of
CMD so that arguments are expanded.

Change-Id: I12685e2b147fc77270678f72bcc18eb429edcb2d
This commit is contained in:
Ian Wienand 2019-11-19 07:49:06 +11:00
parent 3db0f3602c
commit a64649bb7c
1 changed files with 6 additions and 2 deletions

View File

@ -45,11 +45,15 @@ CMD ["/usr/local/bin/nodepool"]
FROM nodepool-base as nodepool-launcher
USER 10001
CMD ["/usr/local/bin/nodepool-launcher", "-f"]
CMD _DAEMON_FLAG=${DEBUG:+-d} && \
_DAEMON_FLAG=${_DAEMON_FLAG:--f} && \
/usr/local/bin/nodepool-launcher ${_DAEMON_FLAG}
FROM nodepool-base as nodepool-builder
# dib needs sudo
RUN echo "nodepool ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/nodepool-sudo \
&& chmod 0440 /etc/sudoers.d/nodepool-sudo
USER 10001
CMD ["/usr/local/bin/nodepool-builder", "-f"]
CMD _DAEMON_FLAG=${DEBUG:+-d} && \
_DAEMON_FLAG=${_DAEMON_FLAG:--f} && \
/usr/local/bin/nodepool-builder ${_DAEMON_FLAG}