Files
rack-planner/Dockerfile
jason 2c95d01e7a Fix Prisma OpenSSL error on Alpine Linux (Docker)
- Add openssl + openssl-dev to Dockerfile apk install; Alpine does not
  ship OpenSSL by default but Prisma's query engine binary requires it
- Add binaryTargets to schema.prisma generator:
    native                    → used during docker build (npx prisma generate)
    linux-musl-openssl-3.0.x  → correct engine binary for Alpine at runtime
  Without the explicit target Prisma defaults to openssl-1.1.x, which
  does not exist on Alpine 3.18+, producing the "Could not parse schema
  engine response" error at migrate/startup time

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-21 22:32:25 -05:00

32 lines
752 B
Docker

FROM node:20-alpine
WORKDIR /app
# Install build tools + OpenSSL (required by Prisma query engine on Alpine)
RUN apk add --no-cache python3 make g++ openssl openssl-dev
# Copy package manifests
COPY package*.json ./
COPY client/package*.json ./client/
# Install all dependencies (dev deps needed for prisma CLI + tsc build)
RUN npm install
RUN cd client && npm install
# Copy source
COPY . .
# Generate Prisma client for target platform (must happen before tsc)
RUN npx prisma generate
# Build server (tsc) + client (vite)
RUN npm run build
# Ensure data directory exists for SQLite bind mount
RUN mkdir -p /app/data
EXPOSE 3001
# Apply pending migrations then start
CMD ["sh", "-c", "npx prisma migrate deploy && node dist/server/index.js"]