diff --git a/.dockerignore b/.dockerignore index a397a0f..4065409 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,8 +1,6 @@ -node_modules +node_modules/ npm-debug.log yarn-error.log -build -public -content -config -.git +public/ +.git/ +.cache/ diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..e8951cb --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,12 @@ +FROM node:13.8.0 as front + +WORKDIR /app +COPY ./ /app/ + +RUN yarn install +RUN yarn run build + +FROM nginx:1.17.8-alpine +RUN rm -rf /usr/share/nginx/html +COPY --from=front /app/public/ /usr/share/nginx/html +COPY default.conf /etc/nginx/conf.d/default.conf diff --git a/docker/default.conf b/docker/default.conf new file mode 100644 index 0000000..333307e --- /dev/null +++ b/docker/default.conf @@ -0,0 +1,21 @@ +server { + listen 80; + root /usr/share/nginx/html; + + index index.html; + autoindex off; + charset urtf-8; + + error_page 404 /404.html; + + access_log /var/log/nginx/access.log; + + location ~* \.(html)$ { + add_header Cache-Control "no-store"; + expires off; + } + + rewrite ^([^.\?]*[^/])$ $1/ permanent; + + try_files $uri $uri/ $uri/index.html =404; +}