Run nginx as a non-root user
This commit is contained in:
parent
f7283b6177
commit
1a28d7882d
2 changed files with 16 additions and 6 deletions
|
@ -18,6 +18,16 @@ RUN npm run production
|
|||
|
||||
FROM nginx:1 AS production
|
||||
COPY tools/docker/images/nginx/root/ /
|
||||
WORKDIR /usr/share/nginx/html
|
||||
COPY --from=build /app/output_prod ./
|
||||
COPY --from=assets /app/source/build build
|
||||
RUN mkdir -p /code && \
|
||||
chown -R nginx:nginx /code && \
|
||||
chmod -R 755 /code && \
|
||||
chown -R nginx:nginx /var/cache/nginx && \
|
||||
chown -R nginx:nginx /var/log/nginx && \
|
||||
chown -R nginx:nginx /etc/nginx/conf.d
|
||||
RUN touch /var/run/nginx.pid && \
|
||||
chown -R nginx:nginx /var/run/nginx.pid
|
||||
USER nginx
|
||||
WORKDIR /code
|
||||
COPY --chown=nginx --from=build /app/output_prod ./
|
||||
COPY --chown=nginx --from=assets /app/source/build build
|
||||
EXPOSE 8080
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue