Spaces:
Build error
Build error
| # Use official Node.js image as base | |
| ARG BASE=node:20-slim | |
| FROM ${BASE} AS base | |
| WORKDIR /app | |
| # Copy dependency files | |
| COPY package.json package-lock.json ./ | |
| # Copy the rest of the source code | |
| COPY . . | |
| # Install system dependencies for canvas | |
| RUN apt-get update && apt-get install -y \ | |
| python3 \ | |
| make \ | |
| g++ \ | |
| libcairo2-dev \ | |
| libjpeg-dev \ | |
| libpango1.0-dev \ | |
| libgif-dev \ | |
| librsvg2-dev \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Install pnpm and dependencies | |
| RUN npm install -g pnpm && pnpm install | |
| # Build Next.js app | |
| RUN pnpm run build | |
| # Production image | |
| FROM base AS production | |
| WORKDIR /app | |
| # Set environment variables for Hugging Face Spaces | |
| ENV PORT=7860 \ | |
| NODE_ENV=production | |
| # Expose the port your app runs on | |
| EXPOSE 7860 | |
| # Start the Next.js app | |
| CMD ["pnpm", "start"] | |