优化dockerfile

This commit is contained in:
none 2023-04-17 16:05:40 +08:00
parent 76d3a939d2
commit 7e16c748f5
2 changed files with 13 additions and 2 deletions

3
.dockerignore Normal file
View File

@ -0,0 +1,3 @@
/node_modules
/build
/dist

View File

@ -1,5 +1,13 @@
FROM node:lts-slim as builder
WORKDIR /app
COPY . /app
RUN yarn config set registry https://registry.npm.taobao.org && yarn && yarn build
FROM nginx:1.23.4-alpine-slim
COPY dist /usr/share/nginx/html
COPY --from=builder /app/dist /usr/share/nginx/html
COPY docker/nginx.conf /etc/nginx/nginx.conf
COPY --from=builder /app/docker/nginx.conf /etc/nginx/nginx.conf