add Dockerfile

main
Cameron Clough 2022-01-10 19:47:55 +00:00
parent 06c7cd01b3
commit cdbd809a0a
4 changed files with 44 additions and 16 deletions

1
.dockerignore 120000
View File

@ -0,0 +1 @@
.gitignore

25
.gitignore vendored
View File

@ -1,30 +1,23 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# IDEs # IDEs
.idea .idea
*.iml *.iml
.vscode .vscode
.atom .atom
*.swp *.swp
*.swo
# dependencies # NPM
/node_modules node_modules
/.pnp
.pnp.js
# testing # Production
/coverage build
# production # Sensitive data
/build
# misc
.DS_Store
.env.local .env.local
.env.development.local .env.development.local
.env.test.local .env.test.local
.env.production.local .env.production.local
npm-debug.log* # Miscellaneous
yarn-debug.log* .DS_Store
yarn-error.log* *.log*

16
Dockerfile 100644
View File

@ -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

18
nginx.conf 100644
View File

@ -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;
}