27 lines
589 B
Docker
27 lines
589 B
Docker
|
|
# syntax=docker/dockerfile:experimental
|
|
FROM node:14.16.1 as build
|
|
WORKDIR /workspace
|
|
|
|
COPY package.json .
|
|
RUN npm config set registry https://registry.npm.taobao.org
|
|
RUN npm install
|
|
|
|
# 打包需要编译或配置的文件
|
|
COPY src src
|
|
COPY public public
|
|
COPY babel.config.js babel.config.js
|
|
COPY vue.config.js vue.config.js
|
|
# 打包命令
|
|
RUN npm run build
|
|
|
|
FROM nginx:1.21.0
|
|
|
|
RUN rm /etc/nginx/conf.d/default.conf
|
|
COPY nginx/nginx.conf /etc/nginx/conf.d
|
|
# 打包后的产物部署
|
|
COPY --from=build workspace/dist /usr/share/nginx/html
|
|
EXPOSE 8065
|
|
CMD ["nginx", "-g", "daemon off;"]
|
|
|