diff --git a/server/frontend/Dockerfile b/server/frontend/Dockerfile index abd0680..d860fd6 100644 --- a/server/frontend/Dockerfile +++ b/server/frontend/Dockerfile @@ -3,4 +3,11 @@ FROM nginx:alpine COPY public/ /usr/share/nginx/html/ COPY nginx.conf /etc/nginx/conf.d/default.conf +RUN HTML=/usr/share/nginx/html/index.html && \ + for f in $(find /usr/share/nginx/html/assets -name "*.css" -o -name "*.js"); do \ + hash=$(md5sum "$f" | cut -c1-8); \ + rel="${f#/usr/share/nginx/html}"; \ + sed -i "s|${rel}\"|${rel}?v=${hash}\"|g" "$HTML"; \ + done + EXPOSE 80 \ No newline at end of file diff --git a/server/frontend/nginx.conf b/server/frontend/nginx.conf index 6d6422c..c22769b 100644 --- a/server/frontend/nginx.conf +++ b/server/frontend/nginx.conf @@ -11,7 +11,7 @@ server { location /assets/ { expires 1y; - add_header Cache-Control "public"; + add_header Cache-Control "public, immutable"; } location = /index.html {