Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add nginx-unpriviliged dockerfile #67

Merged
merged 1 commit into from
Dec 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions Dockerfile.nginx.prod
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
FROM node:18.7.0-alpine3.15 as build

WORKDIR /app

RUN addgroup app && \
adduser -S -G app app

COPY ["package.json", "yarn.lock", "./"]

RUN yarn

COPY . .

RUN yarn build

# 2nd stage
FROM nginx:1.23.3-alpine-slim

USER root

RUN rm /etc/nginx/conf.d/default.conf && \
rm /etc/nginx/nginx.conf && \
chown -R nginx:nginx /var/cache/nginx && \
chown -R nginx:nginx /var/run && \
touch /var/run/nginx.pid && \
chown -R nginx:nginx /var/run/nginx.pid

COPY --from=build /app/dist /usr/share/nginx/html
COPY .nginx/nginx.conf /etc/nginx/nginx.conf
COPY .nginx/conf.d /etc/nginx/conf.d

USER nginx

EXPOSE 80

CMD ["nginx", "-g", "daemon off;"]
Loading