# Use Node 20 (required for newer Next.js versions) FROM node:20-alpine WORKDIR /app # Install OpenSSL (required for Prisma on Alpine) RUN apk add --no-cache openssl # Copy package files COPY package.json package-lock.json ./ # Install dependencies including devDependencies (needed for build) RUN npm ci # Copy the rest of the application COPY . . # DEBUG: List all files to verify structure (src, public, etc.) # RUN ls -R # Generate Prisma Client RUN npx prisma generate # Build the Next.js app RUN npm run build # Expose port (HF Spaces defaults to 7860) EXPOSE 7860 # Set hostname to 0.0.0.0 (required for Docker) and port to 7860 ENV PORT 7860 ENV HOSTNAME "0.0.0.0" # Start command # We use db push because it handles schema sync without migration files (simpler for free tier) # This assumes DATABASE_URL points to a writable volume (e.g. /data/dev.db) CMD npx prisma db push && npm start