Skip to content

Commit

Permalink
fix - rework dockerfile and nginx conf
Browse files Browse the repository at this point in the history
  • Loading branch information
EricThuaud authored May 17, 2024
1 parent 443a547 commit a0e6797
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
22 changes: 20 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,33 @@
FROM nginx:stable-alpine
COPY build /usr/share/nginx/html

## Remove default nginx index page
RUN rm -rf /usr/share/nginx/html/*

ADD build /usr/share/nginx/html

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

# Copy .env file and shell script to container
WORKDIR /usr/share/nginx/html

# Add bash
RUN apk add --no-cache bash

COPY ./scripts/env.sh .
COPY .env .

# Make shell script executable
RUN chmod +x env.sh

# 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

# Start Nginx server
CMD ["/bin/bash", "-c", "/usr/share/nginx/html/env.sh && nginx -g \"daemon off;\""]
2 changes: 1 addition & 1 deletion nginx-frontmoog.conf → 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": "front-moog",
"version": "2.2.5",
"version": "2.2.6",
"private": true,
"dependencies": {
"@vtex/react-csv-parse": "^3.0.2",
Expand Down

0 comments on commit a0e6797

Please sign in to comment.