Add docker support

This commit is contained in:
Sambo Chea 2021-10-21 18:00:40 +07:00
parent 85c81f5e2a
commit a50437a27b
Signed by untrusted user: sombochea
GPG Key ID: 3C7CF22A05D95490
3 changed files with 48 additions and 0 deletions

7
.dockerignore Normal file
View File

@ -0,0 +1,7 @@
.vscode/
node_modules/
npm-debug.log
dist/
build/
test/
yarn-error.log

20
Dockerfile Normal file
View File

@ -0,0 +1,20 @@
# Build application
FROM cubetiq/calpine-node AS builder
WORKDIR /app
COPY package.json ./
# Set custom registry for npm registry (from cubetiq local server)
RUN yarn config set registry https://r.ctdn.net
RUN yarn
COPY . .
RUN yarn build
# Build production image
FROM nginx:alpine
LABEL maintainer="sombochea@cubetiqs.com"
WORKDIR /usr/share/nginx/html
COPY --from=builder /app/build/ /usr/share/nginx/html
COPY --from=builder /app/docker/nginx.conf /etc/nginx/conf.d
RUN rm /etc/nginx/conf.d/default.conf
EXPOSE 80

21
docker/nginx.conf Normal file
View File

@ -0,0 +1,21 @@
server {
listen 80;
# serve static files
location ~ ^/(images|javascript|js|css|flash|media|static)/ {
root /usr/share/nginx/html;
expires 30d;
}
# serve default location
location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}