gongxiangp2/Dockerfile.base

32 lines
987 B
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.

# 由壹点3D素材 - 基础镜像(包含所有依赖)
# 用途:一次性构建,后续部署直接使用,零安装、零复制
ARG BASE_IMAGE=node:18-alpine
FROM ${BASE_IMAGE}
WORKDIR /app
# 复制已解压的 Alpine 包并安装(一次性)
COPY cache/alpine-apk /tmp/alpine-apk
RUN echo "✅ 安装系统包(一次性)" && \
apk add --no-network --allow-untrusted /tmp/alpine-apk/*.apk && \
rm -rf /tmp/alpine-apk
# 复制已解压的 node_modules(一次性)
COPY cache/node_modules ./node_modules
RUN echo "✅ node_modules 已就绪" && \
chmod -R +x node_modules/.bin
# 复制 Prisma schema 并生成 Client(一次性)
COPY prisma ./prisma
RUN echo "✅ 生成 Prisma Client(一次性)" && \
npx prisma generate && \
rm -rf prisma
# 标记为基础镜像
LABEL purpose="youyidian-3d-base" \
description="包含所有依赖的基础镜像" \
version="1.0"
CMD ["echo", "这是基础镜像,不应该直接运行"]