diff --git a/.dockerignore b/.dockerignore new file mode 120000 index 0000000..3e4e48b --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +.gitignore \ No newline at end of file diff --git a/.gitignore b/.gitignore index 0993538..7371467 100644 --- a/.gitignore +++ b/.gitignore @@ -1,30 +1,23 @@ -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - # IDEs .idea *.iml .vscode .atom *.swp +*.swo -# dependencies -/node_modules -/.pnp -.pnp.js +# NPM +node_modules -# testing -/coverage +# Production +build -# production -/build - -# misc -.DS_Store +# Sensitive data .env.local .env.development.local .env.test.local .env.production.local -npm-debug.log* -yarn-debug.log* -yarn-error.log* +# Miscellaneous +.DS_Store +*.log* diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..18aa860 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,16 @@ +FROM node:16-alpine AS builder + +WORKDIR /app + +# Install app dependencies +COPY package*.json ./ +RUN npm ci + +# Build the app +COPY . . +RUN npm run build + +FROM nginx:1.20-alpine AS server + +COPY --from=builder /app/dist/ usr/share/nginx/html +COPY nginx.conf /etc/nginx/conf.d/default.conf diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..046e5d1 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,18 @@ +server { + listen 80; + listen [::]:80; + server_name localhost; + + gzip on; + gzip_types text/html text/plain text/css text/xml text/javascript application/javascript application/x-javascript; + gzip_min_length 1024; + gzip_vary on; + + root /usr/share/nginx/html; + location / { + try_files $uri $uri/ /index.html; + } + + error_page 404 /404.html; + error_page 500 502 503 504 /50x.html; +}