From 01c4137dc9d6e3f8e0e44f56328222d994d27e3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20M=C3=A4der?= Date: Sun, 17 Nov 2019 18:03:59 +0100 Subject: [PATCH] Adds netbox user --- Dockerfile | 10 ++++++++++ docker-compose.yml | 1 + 2 files changed, 11 insertions(+) diff --git a/Dockerfile b/Dockerfile index d7a9af9..da15ecb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -51,6 +51,10 @@ RUN apk add --no-cache \ postgresql-libs \ ttf-ubuntu-font-family +RUN addgroup -S -g 101 netbox \ + && adduser -DHS -u 101 netbox \ + && adduser netbox netbox + WORKDIR /opt COPY --from=builder /install /usr/local @@ -68,6 +72,12 @@ COPY configuration/configuration.py /etc/netbox/config/configuration.py WORKDIR /opt/netbox/netbox +# Must set permissions for '/opt/netbox/netbox/static' directory +# to a+w so that `./manage.py collectstatic` can be executed during +# container startup. +# Not satisfying +RUN mkdir static && chmod a+w static media + ENTRYPOINT [ "/opt/netbox/docker-entrypoint.sh" ] CMD ["gunicorn", "-c /etc/netbox/config/gunicorn_config.py", "netbox.wsgi"] diff --git a/docker-compose.yml b/docker-compose.yml index f00700a..da5fbd5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,6 +7,7 @@ services: - redis - netbox-worker env_file: env/netbox.env + user: netbox volumes: - ./startup_scripts:/opt/netbox/startup_scripts:z,ro - ./initializers:/opt/netbox/initializers:z,ro