You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.1 KiB
41 lines
1.1 KiB
# admin 前端镜像:Nuxt 4 SSR 管理后台
|
|
# 构建上下文:apps/admin/
|
|
# CONSOLE_BACKEND 在容器运行时通过环境变量注入(server middleware 运行时读取)
|
|
|
|
# ============ Stage 1: Builder ============
|
|
FROM node:22-alpine AS builder
|
|
|
|
# 国内网络:corepack 下载 pnpm 与依赖安装均走 npmmirror
|
|
ENV COREPACK_NPM_REGISTRY=https://registry.npmmirror.com \
|
|
npm_config_registry=https://registry.npmmirror.com
|
|
|
|
RUN corepack enable && corepack prepare pnpm@9 --activate
|
|
|
|
WORKDIR /app
|
|
|
|
COPY package.json pnpm-lock.yaml ./
|
|
RUN --mount=type=cache,target=/root/.local/share/pnpm/store \
|
|
pnpm install --frozen-lockfile
|
|
|
|
COPY . .
|
|
RUN pnpm build
|
|
|
|
# ============ Stage 2: Runtime ============
|
|
FROM node:22-alpine
|
|
|
|
RUN sed -i 's#dl-cdn.alpinelinux.org#mirrors.aliyun.com#g' /etc/apk/repositories && \
|
|
apk add --no-cache tzdata && \
|
|
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
|
|
echo "Asia/Shanghai" > /etc/timezone
|
|
|
|
WORKDIR /app
|
|
|
|
COPY --from=builder /app/.output ./
|
|
|
|
ENV NODE_ENV=production \
|
|
PORT=3000 \
|
|
CONSOLE_BACKEND=http://console:8080
|
|
|
|
EXPOSE 3000
|
|
|
|
CMD ["node", "server/index.mjs"]
|
|
|