gongxiangp2/Dockerfile.base

26 lines
1.1 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.

# 旧基础镜像入口仍可使用;依赖必须由当前锁文件在同一 Node ABI 下重建。
# 不再导入历史 Node 18 的 APK / node_modules 缓存。
ARG BASE_IMAGE=node:22.23.4-alpine@sha256:fe4f6d74e20370acb04ad889077d14d0f64a9c8ea6a42bc60cddf1e844699914
FROM ${BASE_IMAGE}
WORKDIR /app
RUN apk add --no-cache libc6-compat python3 make g++ cairo-dev jpeg-dev pango-dev giflib-dev openssl
COPY package.json package-lock.json ./
RUN --mount=type=cache,target=/root/.npm \
npm_config_build_from_source=canvas npm_config_nodedir=/usr/local npm ci --no-audit --no-fund --legacy-peer-deps && \
node -e "require('canvas').createCanvas(1,1); require('sharp'); console.log('native ABI verified')"
# 复制 Prisma schema 并生成 Client(一次性)
COPY prisma ./prisma
RUN echo "✅ 生成 Prisma Client(一次性)" && \
npx prisma generate && \
rm -rf prisma
# 标记为基础镜像
LABEL purpose="youyidian-3d-base" \
description="包含所有依赖的基础镜像" \
version="2.0-node22"
CMD ["echo", "这是基础镜像,不应该直接运行"]