lty/qy-lty-admin/Dockerfile
zyc 4de4595ec0
All checks were successful
Build and Deploy LTY / build-and-deploy (push) Successful in 7m50s
feat: update CI/CD pipeline for multi-env deploy and use mirror registry
- Add dev branch trigger and environment-based config (prod/dev)
- Switch to Volcano container registry with retry logic
- Use mirror images for Docker base images (daocloud.io)
- Add dynamic domain/DB/Redis config per environment

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 15:33:32 +08:00

52 lines
1.2 KiB
Docker
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 构建阶段
FROM docker.m.daocloud.io/node:22.10.0-alpine AS builder
# 设置工作目录
WORKDIR /app
# 设置yarn镜像源为淘宝镜像
RUN yarn config set registry https://registry.npmmirror.com && \
yarn config set disturl https://npmmirror.com/dist --global
# 复制package.json和yarn.lock
COPY package.json yarn.lock* ./
# 安装依赖包括devDependencies用于构建
RUN yarn install --frozen-lockfile
# 复制源代码
COPY . .
# 构建应用
RUN yarn build
# 运行阶段
FROM docker.m.daocloud.io/node:22.10.0-alpine AS runner
# 设置工作目录
WORKDIR /app
# 设置yarn镜像源为淘宝镜像
RUN yarn config set registry https://registry.npmmirror.com && \
yarn config set disturl https://npmmirror.com/dist --global
# 复制package.json和yarn.lock
COPY package.json yarn.lock* ./
# 仅安装生产依赖
RUN yarn install --production --frozen-lockfile
# 设置环境变量
ENV NODE_ENV=production
ENV PATH=/app/node_modules/.bin:$PATH
# 从构建阶段复制构建产物
COPY --from=builder /app/.next ./.next
COPY --from=builder /app/public ./public
COPY --from=builder /app/next.config.mjs ./
# 暴露端口
EXPOSE 3000
# 启动应用
CMD ["yarn", "start"]