diff --git a/Dockerfile b/Dockerfile index 3444a32..ab5c10a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,2 +1,3 @@ FROM nginx:alpine -ADD ./dist /usr/share/nginx/html \ No newline at end of file +ADD ./dist /usr/share/nginx/html +ADD ./nginx /etc/nginx/conf.d \ No newline at end of file diff --git a/nginx/default.conf b/nginx/default.conf new file mode 100644 index 0000000..8eb031f --- /dev/null +++ b/nginx/default.conf @@ -0,0 +1,19 @@ +server { + listen 80; + server_name localhost; + + location / { + root /usr/share/nginx/html; + index index.html; + + # Default caching strategy based on the etag feature (for stuff like index.html and site.webmanifest that don't have a content hash in the name) + etag on; + add_header Cache-Control "no-cache"; + + # Caching strategy for static assets (Vue build those assets with a content hash in the name, so etag is not usefull and the cache will busted automatically if the content of the file change) + location ~ ((\/css)|(\/js)|(\/img)) { + etag off; + add_header Cache-Control "public,max-age=31536000,immutable"; + } + } +} \ No newline at end of file