File size: 1,309 Bytes
9580dce | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | # RotNot — Hugging Face Docker Space image.
#
# A Space runs as a single long-running container (unlike serverless), so the
# local libsql/SQLite database and the in-memory problem store both work as-is.
# Container storage is ephemeral, so the DB is migrated + seeded on every boot
# (seed uses idempotent upserts). Add HF persistent storage if you want XP to
# survive restarts.
FROM node:22-slim
# openssl: required by Prisma. ca-certificates: outbound HTTPS (Anthropic API).
RUN apt-get update \
&& apt-get install -y --no-install-recommends openssl ca-certificates \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Install dependencies first for better layer caching. The schema and prisma
# config are needed because the `postinstall` hook runs `prisma generate`.
COPY package.json package-lock.json prisma.config.ts ./
COPY prisma ./prisma
RUN npm ci
# Copy the rest of the source and build.
COPY . .
ENV NEXT_TELEMETRY_DISABLED=1
RUN npm run build
# Single in-container SQLite DB; matches the cwd default used by seed.ts/db.ts.
ENV DATABASE_URL=file:/app/dev.db
ENV NODE_ENV=production
# HF Spaces run the container as UID 1000 — make the app dir writable so the
# SQLite file can be created at runtime.
RUN chown -R 1000:1000 /app
USER 1000
EXPOSE 7860
CMD ["sh", "scripts/hf-start.sh"]
|