Browse Source

improvement(docker): gzip static files (via #5199)

bubble
Yann Odeyer 5 years ago
committed by kyle
parent
commit
dd961ed401
2 changed files with 9 additions and 0 deletions
  1. +2
    -0
      Dockerfile
  2. +7
    -0
      docker/nginx.conf

+ 2
- 0
Dockerfile View File

@@ -20,6 +20,8 @@ COPY ./dist/* /usr/share/nginx/html/
COPY ./docker/run.sh /usr/share/nginx/
COPY ./docker/configurator /usr/share/nginx/configurator

RUN find /usr/share/nginx/html/ -type f -regex ".*\.\(html\|js\|css\)" -exec sh -c "gzip < {} > {}.gz" \;

RUN chmod +x /usr/share/nginx/run.sh

EXPOSE 8080


+ 7
- 0
docker/nginx.conf View File

@@ -12,6 +12,13 @@ http {

keepalive_timeout 65;

gzip on;
gzip_static on;
gzip_disable "msie6";

gzip_vary on;
gzip_types text/plain text/css application/javascript;

map $request_method $access_control_max_age {
OPTIONS 1728000; # 20 days
}


Loading…
Cancel
Save