From 2d88c8ea9b5f768ebdc601f8ffb7ab207e86db34 Mon Sep 17 00:00:00 2001 From: Nicolai Ort Date: Sat, 13 Feb 2021 22:09:00 +0100 Subject: [PATCH] Implemented basics for deployment via docker --- Dockerfile | 11 +++++++++++ docker-compose.yml | 6 ++++++ nginx.conf | 47 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 64 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.yml create mode 100644 nginx.conf diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..25f9a86 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM node:15.5.1-alpine3.12 AS build +WORKDIR /app +RUN npm i -g pnpm +COPY package.json ./ +RUN pnpm i +COPY . ./ +RUN pnpm run build +# final image +FROM fholzer/nginx-brotli:v1.19.1 AS final +COPY --from=build /app/src/.vuepress/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..f34b74a --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,6 @@ +version: "3.3" +services: + httpd: + build: . + ports: + - 8080:80 \ No newline at end of file diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..2884dea --- /dev/null +++ b/nginx.conf @@ -0,0 +1,47 @@ + +events { +} +http { + include mime.types; + sendfile on; + server { + root /usr/share/nginx/html; + location / { + try_files $uri $uri/ /index.html; + } + + # --- 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