Skip to content

Commit fb3596c

Browse files
Hernan Rojek Moriceaukpfadnis
Hernan Rojek Moriceau
authored andcommitted
Changes base image to official unprivileged NGINX
1 parent f93e6a0 commit fb3596c

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

Dockerfile

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ RUN yarn run build
2525

2626
# ==== SET ENV NGINX =====
2727
# Bundle static assets with nginx
28-
FROM nginx:1.21.0-alpine as production
28+
FROM nginxinc/nginx-unprivileged:1.23.0-alpine as production
2929
ENV NODE_ENV production
3030
# Copy built assets from `builder` image
3131
COPY --from=builder /app/build /usr/share/nginx/html
@@ -35,10 +35,15 @@ COPY deployment.sh docker-entrypoint.d/.
3535
# Add your nginx.conf
3636
COPY nginx.conf /etc/nginx/conf.d/default.conf
3737
# Expose port
38-
EXPOSE 82
38+
EXPOSE 8000
3939

4040
# ==== START SERVER =====
4141
# Start nginx
4242
CMD ["nginx", "-g", "daemon off;"]
43-
# Fails with permission denied
44-
# USER 2000
43+
44+
# needed for chmod
45+
USER root
46+
# needed for write access for deployment.sh
47+
RUN mkdir /tmp/proxy_temp && chmod 0757 /usr/share/nginx/html/
48+
# reinstate the user
49+
USER nginx

nginx.conf

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
server {
2-
listen 82;
32

43
location / {
54
root /usr/share/nginx/html/;
65
include /etc/nginx/mime.types;
76
try_files $uri $uri/ /index.html;
87
}
9-
}
8+
}

0 commit comments

Comments
 (0)