Skip to content

Commit de58065

Browse files
committed
update the Dockerfile to run as a non-privileged user
1 parent e6914d4 commit de58065

2 files changed

Lines changed: 13 additions & 4 deletions

File tree

apps/nar-v3/deployment/Dockerfile

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,16 @@ RUN npm run build
1313

1414
# production environment
1515
FROM docker-registry.ebrains.eu/neuralactivity/nginx:stable-alpine
16+
17+
# Make nginx dirs writable for non-root user (UID 1001)
18+
RUN chown -R 1001:0 /var/cache/nginx /var/log/nginx /etc/nginx/conf.d && \
19+
chmod -R g+w /var/cache/nginx /var/log/nginx /etc/nginx/conf.d && \
20+
sed -i 's/^user nginx;/#user nginx;/' /etc/nginx/nginx.conf && \
21+
sed -i 's|/var/run/nginx.pid|/tmp/nginx.pid|' /etc/nginx/nginx.conf
22+
1623
COPY deployment/nginx_default /etc/nginx/conf.d/default.conf
1724
COPY --from=build /app/dist /usr/share/nginx/html
18-
EXPOSE 80
25+
26+
EXPOSE 8080
27+
USER 1001
1928
CMD ["nginx", "-g", "daemon off;"]

apps/nar-v3/deployment/nginx_default

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ server {
2929
root /usr/share/nginx/html;
3030
index index.html;
3131

32-
listen 80;
32+
listen 8080;
3333

34-
access_log /var/log/nginx/access.log anonymized;
35-
error_log /var/log/nginx/error.log crit;
34+
access_log /dev/stdout anonymized;
35+
error_log /dev/stderr crit;
3636

3737
location / {
3838
try_files $uri /index.html;

0 commit comments

Comments
 (0)