Skip to content

Commit 0a9991d

Browse files
authored
Merge pull request #186 from netbox-community/non-root
Non root
2 parents 28c786c + 5e92352 commit 0a9991d

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,13 @@ COPY configuration/configuration.py /etc/netbox/config/configuration.py
6868

6969
WORKDIR /opt/netbox/netbox
7070

71+
# Must set permissions for '/opt/netbox/netbox/static' directory
72+
# to g+w so that `./manage.py collectstatic` can be executed during
73+
# container startup.
74+
# Must set permissions for '/opt/netbox/netbox/media' directory
75+
# to g+w so that pictures can be uploaded to netbox.
76+
RUN mkdir static && chmod g+w static media
77+
7178
ENTRYPOINT [ "/opt/netbox/docker-entrypoint.sh" ]
7279

7380
CMD ["gunicorn", "-c /etc/netbox/config/gunicorn_config.py", "netbox.wsgi"]

docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ services:
77
- redis
88
- netbox-worker
99
env_file: env/netbox.env
10+
user: '101'
1011
volumes:
1112
- ./startup_scripts:/opt/netbox/startup_scripts:z,ro
1213
- ./initializers:/opt/netbox/initializers:z,ro

docker/docker-entrypoint.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/bin/bash
22
set -e
3+
umask 002
34

45
# wait shortly and then run db migrations (retry on error)
56
while ! ./manage.py migrate 2>&1; do

0 commit comments

Comments
 (0)