🔨 Add Dockerfile

This commit is contained in:
SebClem 2022-06-30 19:13:43 +02:00 committed by root
parent 4fb094b245
commit bfb46b6c2c
4 changed files with 77 additions and 1 deletions

35
.dockerignore Normal file
View File

@ -0,0 +1,35 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
.DS_Store
dist
dist-ssr
coverage
*.local
/cypress/videos/
/cypress/screenshots/
# Editor directories and files
.vscode/*
!.vscode/extensions.json
!.vscode/settings.json
!.vscode/launch.json
.idea
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
.yarn/cache
.yarn/install-state.gz
.yarn/unplugged
.eslintcache

2
.gitignore vendored
View File

@ -30,5 +30,5 @@ coverage
*.sw?
.yarn/cache
.yarn/install-state.gz
.yarn/unplugged
.eslintcache

31
Dockerfile Normal file
View File

@ -0,0 +1,31 @@
FROM node:16 AS builder
WORKDIR /app
COPY package.json .
COPY yarn.lock .
COPY .yarn/releases/* .yarn/releases/
COPY .yarnrc.yml .
RUN yarn install
COPY . .
RUN yarn build
# nginx state for serving content
FROM nginx:alpine
# Set working directory to nginx asset directory
WORKDIR /usr/share/nginx/html
# Remove default nginx static assets
RUN rm -rf ./*
# Copy static assets from builder stage
COPY --from=builder /app/dist .
COPY nginx.conf /etc/nginx/conf.d/default.conf
# Containers run nginx with global directives and daemon off
ENTRYPOINT ["nginx", "-g", "daemon off;"]
LABEL \
org.label-schema.name="Claptrap Bot" \
org.label-schema.url="https://claptrapbot.com" \
org.label-schema.vcs-url="https://github.com/Sebclem/Claptrap-ui" \
org.label-schema.vendor="Sebclem"

10
nginx.conf Normal file
View File

@ -0,0 +1,10 @@
server {
listen 80;
server_name frontend;
location / {
root /usr/share/nginx/html/;
index index.html;
include /etc/nginx/mime.types;
try_files $uri $uri/ /index.html;
}
}