sel-chat-coach / Dockerfile
tblaisaacliao's picture
feat: Add production deployment support with Supabase and Docker
abfec10
# Use the official Node.js 20 image
FROM node:20-alpine
# Set the working directory
WORKDIR /app
# Update npm to latest version to avoid the "Exit handler never called" error
RUN npm install -g npm@latest
# Copy package.json only (not package-lock.json)
COPY package.json ./
# Clear npm cache and install dependencies fresh
RUN npm cache clean --force && npm install --no-package-lock
# Copy the rest of the application
COPY . .
# Build the Next.js application
RUN npm run build
# Note: Database seeding is skipped - Supabase auto-seeds on first connection
# Prompt templates (9 students + 3 coaches) are automatically loaded from TypeScript files
# Set environment variables
ENV PORT=7860
ENV CZ_OPENAI_API_KEY=""
ENV MODEL_NAME="gpt-4o-mini"
# Change ownership of everything to UID 1000 before switching user
RUN chown -R 1000:1000 /app
# Expose Hugging Face default port
EXPOSE 7860
# Switch to non-root user for Hugging Face Spaces (UID 1000)
USER 1000
# Start Next.js on port 7860
CMD ["npm", "start"]