fix(leaderboard-service): 修复 Dockerfile 使用 Debian slim 解决 Prisma 兼容性问题
- Builder 阶段从 node:20-alpine 改为 node:20-slim - 解决 Alpine Linux 上 @prisma/engines 下载失败问题 (ECONNRESET) - 使用 COPY src ./src 替代 COPY . . 优化构建 - 添加构建输出验证步骤 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
c3931255d3
commit
7d87296d11
|
|
@ -1,13 +1,21 @@
|
|||
# Multi-stage build for production
|
||||
FROM node:20-alpine AS builder
|
||||
# =============================================================================
|
||||
# Leaderboard Service Dockerfile
|
||||
# =============================================================================
|
||||
|
||||
# Build stage - use Debian slim for better Prisma compatibility
|
||||
FROM node:20-slim AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Install OpenSSL for Prisma
|
||||
RUN apk add --no-cache openssl
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
openssl \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Copy package files
|
||||
COPY package*.json ./
|
||||
COPY tsconfig*.json ./
|
||||
COPY nest-cli.json ./
|
||||
COPY prisma ./prisma/
|
||||
|
||||
# Install dependencies
|
||||
|
|
@ -17,11 +25,14 @@ RUN npm ci
|
|||
RUN DATABASE_URL="postgresql://user:pass@localhost:5432/db" npx prisma generate
|
||||
|
||||
# Copy source code
|
||||
COPY . .
|
||||
COPY src ./src
|
||||
|
||||
# Build the application
|
||||
RUN npm run build
|
||||
|
||||
# Verify build output exists
|
||||
RUN ls -la dist/src/ && test -f dist/src/main.js
|
||||
|
||||
# Production stage - use Debian slim for OpenSSL compatibility
|
||||
FROM node:20-slim AS production
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue