midah Claude Opus 4.7 (1M context) commited on
Commit
c856b6c
·
1 Parent(s): e111d69

Switch Docker base from node:20-alpine to node:20-slim

Browse files

The HF Spaces build failed at `prisma db push` with a libssl/openssl
detection mismatch on alpine. Prisma's officially supported Linux distro
is Debian; node:20-slim ships with OpenSSL 3 and avoids the
linux-musl vs linux-musl-openssl-3.0 binary-target dance.

Side effects:
- apk → apt-get for system packages (openssl, ca-certificates explicit)
- adduser/addgroup → useradd/groupadd (Debian utils)
- ~100 MB larger base image; acceptable trade for build reliability

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

Files changed (1) hide show
  1. Dockerfile +9 -4
Dockerfile CHANGED
@@ -2,12 +2,17 @@
2
  # Builder seeds SQLite from the bundled JSONL so the image ships ready-to-serve
3
  # (HF Spaces free tier has ephemeral storage; baking the DB into the image is
4
  # faster and lets Next.js pre-render with real data).
 
 
 
5
 
6
- FROM node:20-alpine AS base
 
 
 
7
 
8
  # Install dependencies only when needed
9
  FROM base AS deps
10
- RUN apk add --no-cache libc6-compat
11
  WORKDIR /app
12
 
13
  COPY package.json package-lock.json* ./
@@ -42,8 +47,8 @@ ENV NEXT_TELEMETRY_DISABLED=1
42
  # Must match builder so Prisma reads the dev.db that was just seeded
43
  ENV DATABASE_URL=file:./prisma/dev.db
44
 
45
- RUN addgroup --system --gid 1001 nodejs
46
- RUN adduser --system --uid 1001 nextjs
47
 
48
  # Copy necessary files from the standalone build.
49
  # `prisma/` needs to be owned by `nextjs` so SQLite can write journal/WAL
 
2
  # Builder seeds SQLite from the bundled JSONL so the image ships ready-to-serve
3
  # (HF Spaces free tier has ephemeral storage; baking the DB into the image is
4
  # faster and lets Next.js pre-render with real data).
5
+ #
6
+ # Base: node:20-slim (Debian) rather than alpine — Prisma's officially supported
7
+ # Linux platform, ships with OpenSSL 3, no libssl detection mismatches.
8
 
9
+ FROM node:20-slim AS base
10
+ RUN apt-get update \
11
+ && apt-get install -y --no-install-recommends openssl ca-certificates \
12
+ && rm -rf /var/lib/apt/lists/*
13
 
14
  # Install dependencies only when needed
15
  FROM base AS deps
 
16
  WORKDIR /app
17
 
18
  COPY package.json package-lock.json* ./
 
47
  # Must match builder so Prisma reads the dev.db that was just seeded
48
  ENV DATABASE_URL=file:./prisma/dev.db
49
 
50
+ RUN groupadd --system --gid 1001 nodejs \
51
+ && useradd --system --uid 1001 --gid 1001 --shell /bin/sh nextjs
52
 
53
  # Copy necessary files from the standalone build.
54
  # `prisma/` needs to be owned by `nextjs` so SQLite can write journal/WAL