Skip to content

Commit

Permalink
build: add docker conf
Browse files Browse the repository at this point in the history
  • Loading branch information
MailineN committed Aug 27, 2024
1 parent c098b62 commit 650ef37
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
README.md
node_modules
package-lock.json
.git
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM nginx
COPY build /usr/share/nginx/html
RUN rm etc/nginx/conf.d/default.conf
COPY nginx/nginx.conf etc/nginx/conf.d/
CMD ["nginx", "-g", "daemon off;"]
34 changes: 34 additions & 0 deletions nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
server {
listen 80 default_server;
server_name /usr/share/nginx/html;

root /usr/share/nginx/html;
index index.html;

location ~* \.(?:manifest|appcache|html?|xml|json)$ {
expires -1;
# access_log logs/static.log; # I don't usually include a static log
}

location ~* \.(?:css|js)$ {
try_files $uri =404;
expires 1y;
access_log off;
add_header Cache-Control "public";
}

location /static {
alias /var/www/static;
expires max;
}

# Any route containing a file extension (e.g. /devicesfile.js)
location ~ ^.+\..+$ {
try_files $uri =404;
}

# Any route that doesn't have a file extension (e.g. /devices)
location / {
try_files $uri $uri/ /index.html;
}
}

0 comments on commit 650ef37

Please sign in to comment.