Files
ThriveX-Admin/dockerfile

33 lines
624 B
Plaintext
Raw Permalink Normal View History

2024-10-11 15:37:48 +08:00
# 使用官方的Node.js镜像作为基础镜像
2024-11-26 21:28:39 +08:00
FROM node:20-alpine AS builder
2024-10-11 15:37:48 +08:00
# 设置工作目录
WORKDIR /thrive
# 复制 package.json 和 package-lock.json
2024-11-26 21:28:39 +08:00
COPY package*.json ./
2024-10-11 15:37:48 +08:00
# 配置 npm 镜像源
RUN npm config set registry https://registry.npmmirror.com
# 安装依赖
RUN npm install
# 复制项目文件
2024-11-26 21:28:39 +08:00
COPY . .
2024-10-11 15:37:48 +08:00
# 构建项目
RUN npm run build
# 使用 Nginx 作为生产环境的基础镜像
FROM nginx:alpine
# 复制构建输出到 Nginx 的默认静态文件目录
2024-11-26 21:28:39 +08:00
COPY --from=builder /thrive/dist /usr/share/nginx/html
2024-10-11 15:37:48 +08:00
# 暴露端口
2024-11-26 21:28:39 +08:00
EXPOSE 80
2024-10-11 15:37:48 +08:00
# 启动 Nginx
CMD ["nginx", "-g", "daemon off;"]