From dd961ed4018c426eed92bcf9c1e9ccb81c2cc678 Mon Sep 17 00:00:00 2001 From: Yann Odeyer Date: Sat, 2 Mar 2019 06:06:40 +0100 Subject: [PATCH] improvement(docker): gzip static files (via #5199) --- Dockerfile | 2 ++ docker/nginx.conf | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/Dockerfile b/Dockerfile index 39ee8e2b..f1b08544 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 diff --git a/docker/nginx.conf b/docker/nginx.conf index e0bba341..d66d0414 100644 --- a/docker/nginx.conf +++ b/docker/nginx.conf @@ -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 }