TOPVERSE_Official/Dockerfile

38 lines
809 B
Docker
Raw Normal View History

2024-05-24 16:24:20 +08:00
FROM node:21 AS build
# 容器内的目录通常我们会使用 app 目录
WORKDIR /app
# 拷贝项目文件到容器/app下
COPY . .
2023-05-16 16:51:05 +08:00
2024-05-24 16:24:20 +08:00
# ARG env_file
2023-05-16 16:51:05 +08:00
2023-05-16 17:20:43 +08:00
2024-05-24 16:24:20 +08:00
# RUN npm config set registry https://mirrors.tuna.tsinghua.edu.cn/npm
2024-05-25 02:53:51 +08:00
# RUN npm install -g pnpm
2024-05-24 16:24:20 +08:00
# RUN pnpm config set registry https://mirrors.tuna.tsinghua.edu.cn/npm
# 下载编译
2024-05-25 02:53:51 +08:00
# RUN pnpm i
2024-05-24 16:24:20 +08:00
# RUN pnpm build
2024-05-25 02:53:51 +08:00
# RUN pnpm generate
2024-05-25 03:21:23 +08:00
RUN yarn config set registry https://registry.npmmirror.com
2024-05-25 02:53:51 +08:00
RUN yarn
2024-05-24 16:24:20 +08:00
# RUN yarn build
2024-05-25 02:53:51 +08:00
RUN yarn generate
2024-05-24 16:24:20 +08:00
# nginx默认暴露80端口
FROM nginx
# 更换工作目录到nginx服务目录下
WORKDIR /usr/share/nginx/html
2023-05-16 16:51:05 +08:00
2024-05-24 16:24:20 +08:00
# 删除服务下可能存在的无用项目
RUN rm -rf ./*
2023-05-16 16:51:05 +08:00
2024-05-24 16:24:20 +08:00
# 复制自定义的 Nginx 配置文件
COPY nginx.conf /etc/nginx/nginx.conf
2023-05-16 16:51:05 +08:00
2024-05-24 16:24:20 +08:00
# 拷贝打包的文件
COPY --from=build /app/dist .