From 5f182d3bc6ff2f3a4f76135ff7e6adcad0c3505f Mon Sep 17 00:00:00 2001 From: Denis Davidyuk Date: Fri, 19 May 2023 16:04:38 +0600 Subject: [PATCH] perf: enable gzip based on https://cli.vuejs.org/guide/deployment.html#docker-nginx --- .dockerignore | 2 +- Dockerfile | 3 +-- docker/nginx.conf | 35 +++++++++++++++++++++++++++++++++++ docker/nginx/default.conf | 6 ------ docker/nginx/nginx.conf | 19 ------------------- 5 files changed, 37 insertions(+), 28 deletions(-) create mode 100644 docker/nginx.conf delete mode 100644 docker/nginx/default.conf delete mode 100644 docker/nginx/nginx.conf diff --git a/.dockerignore b/.dockerignore index 6bffbcf10..3c59030ba 100644 --- a/.dockerignore +++ b/.dockerignore @@ -8,4 +8,4 @@ !.postcssrc.js !babel.config.js !vue.config.js -!docker/nginx +!docker/nginx.conf diff --git a/Dockerfile b/Dockerfile index 55fbbc1ba..967e66614 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,6 +19,5 @@ ARG VUE_APP_BACKEND_URL RUN NODE_OPTIONS=--openssl-legacy-provider npm run build FROM nginx:1.24-alpine -COPY docker/nginx/nginx.conf /etc/nginx/nginx.conf -COPY docker/nginx/default.conf /etc/nginx/conf.d/default.conf +COPY docker/nginx.conf /etc/nginx/nginx.conf COPY --from=aepp-aepp-base-build /app/dist /usr/share/nginx/html diff --git a/docker/nginx.conf b/docker/nginx.conf new file mode 100644 index 000000000..9f8cd3116 --- /dev/null +++ b/docker/nginx.conf @@ -0,0 +1,35 @@ +user nginx; +worker_processes 1; + +error_log /var/log/nginx/error.log warn; +pid /var/run/nginx.pid; + +events { + worker_connections 1024; +} + +http { + include /etc/nginx/mime.types; + types { + application/json map; + } + default_type application/octet-stream; + + sendfile on; + keepalive_timeout 60; + gzip on; + gzip_types application/javascript text/css image/svg+xml; + + server { + root /usr/share/nginx/html; + + location ~ /(css|img|js) { + expires max; + etag off; + } + + location / { + try_files $uri $uri/ /index.html; + } + } +} diff --git a/docker/nginx/default.conf b/docker/nginx/default.conf deleted file mode 100644 index 5e75018f2..000000000 --- a/docker/nginx/default.conf +++ /dev/null @@ -1,6 +0,0 @@ -server { - location / { - root /usr/share/nginx/html; - try_files $uri $uri/ /index.html; - } -} diff --git a/docker/nginx/nginx.conf b/docker/nginx/nginx.conf deleted file mode 100644 index a50386e41..000000000 --- a/docker/nginx/nginx.conf +++ /dev/null @@ -1,19 +0,0 @@ -user nginx; -worker_processes 1; - -error_log /var/log/nginx/error.log warn; -pid /var/run/nginx.pid; - - -events { - worker_connections 1024; -} - -http { - include /etc/nginx/mime.types; - default_type application/octet-stream; - sendfile off; - keepalive_timeout 60; - gzip on; - include /etc/nginx/conf.d/*.conf; -}