tinker / Dockerfile
truegleai's picture
fix: tolerate prisma migrate deploy error for fresh SQLite DB
e0c77ca verified
raw
history blame contribute delete
996 Bytes
FROM node:20-slim
WORKDIR /app
# Install dependencies needed for Prisma native binaries
RUN apt-get update && apt-get install -y --no-install-recommends \
openssl \
libssl3 \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Install pnpm
RUN npm install -g pnpm
# Copy package files
COPY package.json pnpm-lock.yaml ./
# Install dependencies
RUN pnpm install --frozen-lockfile
# Copy everything else
COPY . .
# For HF Spaces: swap to SQLite schema AFTER COPY . . (which overwrites it)
RUN cp prisma/schema.sqlite.prisma prisma/schema.prisma
# Generate Prisma client for SQLite
RUN npx prisma generate
# Build Next.js
RUN pnpm build
# Create data directory for SQLite
RUN mkdir -p /app/data
# Run SQLite migration (ignore error if no migrations exist)
RUN npx prisma migrate deploy || echo "No migrations to apply or migration skipped"
# Expose HF Spaces default port
EXPOSE 7860
# Start custom server (Next.js + WebSocket integrated)
CMD ["npx", "tsx", "server.ts"]