Files
thebet365/docker/player/Dockerfile
2026-06-13 17:38:25 +08:00

33 lines
1.3 KiB
Docker
Raw 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 node:22-alpine AS base
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable && corepack prepare pnpm@11.5.2 --activate
FROM base AS deps
WORKDIR /app
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
COPY apps/api/package.json apps/api/
COPY apps/player/package.json apps/player/
COPY apps/admin/package.json apps/admin/
COPY packages/shared/package.json packages/shared/
RUN pnpm install --no-frozen-lockfile
FROM base AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY --from=deps /app/apps/api/node_modules ./apps/api/node_modules
COPY --from=deps /app/apps/player/node_modules ./apps/player/node_modules
COPY --from=deps /app/apps/admin/node_modules ./apps/admin/node_modules
COPY --from=deps /app/packages/shared/node_modules ./packages/shared/node_modules
COPY . .
# 移除历史中文目录(解压 zip 覆盖部署时可能残留Linux 下会导致 vite publicDir 复制失败)
RUN find packages/shared/public -mindepth 1 -maxdepth 1 -type d \
! -name flags ! -name players -exec rm -rf {} + 2>/dev/null || true
RUN pnpm --filter @thebet365/shared build
RUN pnpm --filter @thebet365/player build
FROM nginx:1.27-alpine
COPY docker/nginx/player.conf /etc/nginx/conf.d/default.conf
COPY --from=builder /app/apps/player/dist /usr/share/nginx/html
EXPOSE 80