Skip to content

Commit

Permalink
chore: add docker support
Browse files Browse the repository at this point in the history
  • Loading branch information
LHRUN committed Jan 13, 2024
1 parent ace78cf commit a7d7f9d
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# dependencies
node_modules

# build outputs
dist

# configurations
.github
.vscode

# documentation
README.md
README.zh.md
CHANGELOG.md
CONTRIBUTING.md
LICENSE

# macOS system files
.DS_Store
16 changes: 16 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM node:16-alpine as build-stage
LABEL maintainer="Leo '[email protected]'"

WORKDIR /app
COPY . ./

RUN echo "https://registry.npmmirror.com" > .npmrc && \
npm install -g pnpm && \
pnpm install --frozen-lockfile && \
pnpm build

FROM nginx:stable-alpine
COPY --from=build-stage /app/dist /usr/share/nginx/html/dist
COPY --from=build-stage /app/nginx.conf /etc/nginx/nginx.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
28 changes: 28 additions & 0 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
worker_processes auto;
events {
worker_connections 1024;
}

http {
include mime.types;
default_type application/octet-stream;

sendfile on;
keepalive_timeout 65;

add_header 'Access-Control-Allow-Origin' '*';

server {
listen 80;

location /paint-board {
alias /usr/share/nginx/html/dist;
try_files $uri $uri/ /index.html;
index index.html;
}

location / {
return 301 $scheme://$http_host/paint-board/;
}
}
}

0 comments on commit a7d7f9d

Please sign in to comment.