Skip to content

Commit

Permalink
fix - add rootless dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
EricThuaud authored May 17, 2024
1 parent 9e3a7fa commit bb30e05
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
18 changes: 15 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,24 @@
FROM nginx:stable-alpine

RUN rm -rf /usr/share/nginx/html/*

ADD build /usr/share/nginx/html

RUN rm etc/nginx/conf.d/default.conf
COPY nginx.conf etc/nginx/conf.d/

# add non-root user
RUN touch /var/run/nginx.pid
RUN chown -R nginx:nginx /var/run/nginx.pid /usr/share/nginx/html /var/cache/nginx /var/log/nginx /etc/nginx/conf.d

# non root users cannot listen on 80
EXPOSE 8080

USER nginx


COPY entrypoint.sh /entrypoint.sh
RUN chmod 755 /entrypoint.sh
ENTRYPOINT [ "/entrypoint.sh" ]

CMD ["nginx", "-g", "daemon off;"]
# Start Nginx server
ENTRYPOINT sh -c "./entrypoint.sh && nginx -g 'daemon off;'"
RUN chmod +x entrypoint.sh
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;
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": "platine-my-surveys",
"version": "0.2.19",
"version": "0.2.20",
"private": true,
"dependencies": {
"@emotion/react": "^11.9.0",
Expand Down

0 comments on commit bb30e05

Please sign in to comment.