Switch tactical-nats to run as non-root

This commit is contained in:
Joel DeTeves
2022-01-15 21:21:58 -08:00
parent 9b55bc9892
commit f16ece6207
2 changed files with 12 additions and 3 deletions

View File

@@ -10,9 +10,20 @@ SHELL ["/bin/bash", "-e", "-o", "pipefail", "-c"]
COPY natsapi/bin/nats-api /usr/local/bin/
RUN chmod +x /usr/local/bin/nats-api
RUN touch /usr/local/bin/config_watcher.sh
RUN chown 1001:1001 /usr/local/bin/config_watcher.sh
RUN mkdir -p /var/log/supervisor
RUN mkdir -p /etc/supervisor/conf.d
RUN touch /etc/supervisor/conf.d/supervisor.conf
RUN chown 1001:1001 /etc/supervisor/conf.d/supervisor.conf
COPY docker/containers/tactical-nats/entrypoint.sh /
RUN chmod +x /entrypoint.sh
ENTRYPOINT [ "/entrypoint.sh" ]
USER 1001
EXPOSE 4222

View File

@@ -40,12 +40,10 @@ EOF
echo "${config_watcher}" > /usr/local/bin/config_watcher.sh
chmod +x /usr/local/bin/config_watcher.sh
mkdir -p /var/log/supervisor
mkdir -p /etc/supervisor/conf.d
supervisor_config="$(cat << EOF
[supervisord]
nodaemon=true
logfile=/tmp/supervisord.log
[include]
files = /etc/supervisor/conf.d/*.conf