diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..71e6dca --- /dev/null +++ b/Dockerfile @@ -0,0 +1,9 @@ +FROM node:15.9.0-alpine3.13 +WORKDIR /app +COPY . . +RUN yarn +RUN yarn build +# final image +FROM fholzer/nginx-brotli:v1.19.1 +COPY --from=0 /app/dist /usr/share/nginx/html +COPY ./nginx.conf /etc/nginx/nginx.conf \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..1935f76 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,6 @@ +version: "3" +services: + httpd: + build: . + ports: + - 4050:80 diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..7f7cb37 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,51 @@ +events { +} +http { + include mime.types; + sendfile on; + server { + error_page 404 /index.html; + root /usr/share/nginx/html; + location / { + try_files $uri $uri/ /index.html; + } + location ~* \.(?:ico|css|gif|jpe?g|png)$ { + expires 1y; + add_header Pragma public; + add_header Cache-Control "public"; + } + # --- Brotli + brotli on; + brotli_comp_level 6; + brotli_static on; + brotli_types application/atom+xml application/javascript application/json application/rss+xml application/vnd.ms-fontobject application/x-font-opentype application/x-font-truetype application/x-font-ttf application/x-javascript application/xhtml+xml application/xml font/eot font/opentype font/otf font/truetype image/svg+xml image/vnd.microsoft.icon image/x-icon image/x-win-bitmap text/css text/javascript text/plain text/xml; + # --- GZIP + gzip on; + gzip_disable "msie6"; + gzip_vary on; + gzip_proxied any; + gzip_comp_level 6; + gzip_buffers 16 8k; + gzip_http_version 1.1; + gzip_types application/javascript + application/rss+xml + application/vnd.ms-fontobject + application/x-font + application/x-font-opentype + application/x-font-otf + application/x-font-truetype + application/x-font-ttf + application/x-javascript + application/xhtml+xml + application/xml + font/opentype + font/otf + font/ttf + image/svg+xml + image/x-icon + text/css + text/javascript + text/plain + text/xml; + } +} \ No newline at end of file