Skip to content

Commit 01c4137

Browse files
committed
Adds netbox user
1 parent c083baf commit 01c4137

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

Dockerfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ RUN apk add --no-cache \
5151
postgresql-libs \
5252
ttf-ubuntu-font-family
5353

54+
RUN addgroup -S -g 101 netbox \
55+
&& adduser -DHS -u 101 netbox \
56+
&& adduser netbox netbox
57+
5458
WORKDIR /opt
5559

5660
COPY --from=builder /install /usr/local
@@ -68,6 +72,12 @@ COPY configuration/configuration.py /etc/netbox/config/configuration.py
6872

6973
WORKDIR /opt/netbox/netbox
7074

75+
# Must set permissions for '/opt/netbox/netbox/static' directory
76+
# to a+w so that `./manage.py collectstatic` can be executed during
77+
# container startup.
78+
# Not satisfying
79+
RUN mkdir static && chmod a+w static media
80+
7181
ENTRYPOINT [ "/opt/netbox/docker-entrypoint.sh" ]
7282

7383
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: netbox
1011
volumes:
1112
- ./startup_scripts:/opt/netbox/startup_scripts:z,ro
1213
- ./initializers:/opt/netbox/initializers:z,ro

0 commit comments

Comments
 (0)