更改docker

This commit is contained in:
liuxi 2025-01-22 10:07:49 +08:00
parent 2872fe834c
commit 914ef7a135
2 changed files with 28 additions and 28 deletions

View File

@ -1,26 +1,26 @@
# syntax=docker/dockerfile:experimental
FROM node:14.16.1 as build
WORKDIR /workspace
# 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 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
# # 打包需要编译或配置的文件
# 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_prd.conf /etc/nginx/conf.d
COPY nginx/nginx.conf /etc/nginx/conf.d
# 打包后的产物部署
COPY --from=build workspace/dist /usr/share/nginx/html
COPY dist /usr/share/nginx/html
EXPOSE 8065
CMD ["nginx", "-g", "daemon off;"]

View File

@ -1,26 +1,26 @@
# syntax=docker/dockerfile:experimental
FROM node:14.16.1 as build
WORKDIR /workspace
# 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 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
# # 打包需要编译或配置的文件
# 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_stg.conf /etc/nginx/conf.d
COPY nginx/nginx.conf /etc/nginx/conf.d
# 打包后的产物部署
COPY --from=build workspace/dist /usr/share/nginx/html
COPY dist /usr/share/nginx/html
EXPOSE 8065
CMD ["nginx", "-g", "daemon off;"]