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

build: make docker image root-less #556

Merged
merged 4 commits into from
May 3, 2024
Merged
Show file tree
Hide file tree
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
20 changes: 14 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
FROM nginx
RUN rm -rf /usr/share/nginx/html/*
FROM nginxinc/nginx-unprivileged:1.25-alpine

ADD build /usr/share/nginx/html
# Non root user
ENV NGINX_USER_ID=101
ENV NGINX_GROUP_ID=101
ENV NGINX_USER=nginx

RUN rm etc/nginx/conf.d/default.conf
COPY ./nginx.conf /etc/nginx/conf.d/
USER $NGINX_USER_ID

# Add build to nginx root webapp
COPY --chown=$NGINX_USER:$NGINX_USER build /usr/share/nginx/html

# Copy nginx configuration
RUN rm etc/nginx/conf.d/default.conf
COPY --chown=$NGINX_USER:$NGINX_USER nginx.conf etc/nginx/conf.d/

COPY entrypoint.sh /entrypoint.sh
# Add entrypoint
COPY --chown=$NGINX_USER:$NGINX_USER entrypoint.sh /entrypoint.sh
RUN chmod 755 /entrypoint.sh
ENTRYPOINT [ "/entrypoint.sh" ]

Expand Down
2 changes: 1 addition & 1 deletion nginx.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
server {
listen 80 default_server;
listen 8080 default_server;
server_name /usr/share/nginx/html;

root /usr/share/nginx/html;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "stromae",
"version": "2.4.18",
"version": "2.4.19",
"description": "Web application for the management of questionnaires powered by Lunatic",
"repository": {
"type": "git",
Expand Down
Loading