Spaces:
Sleeping
Sleeping
| FROM python:3.10-slim | |
| # Install Node.js | |
| RUN apt-get update && apt-get install -y curl && \ | |
| curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \ | |
| apt-get install -y nodejs && \ | |
| apt-get clean && rm -rf /var/lib/apt/lists/* | |
| WORKDIR /app | |
| # Setup Backend Requirements | |
| COPY backend/requirements.txt /app/backend/ | |
| RUN pip install --no-cache-dir -r /app/backend/requirements.txt | |
| # Copy Model Artifacts (helps Docker caching if these don't change often) | |
| COPY new_model /app/new_model | |
| # Copy dataset for database seeding | |
| COPY dataset /app/dataset | |
| # Copy the rest of the backend | |
| COPY backend /app/backend | |
| # Setup Frontend | |
| COPY frontend /app/frontend | |
| WORKDIR /app/frontend | |
| RUN npm install | |
| # Next.js build needs this to configure API URL correctly at runtime | |
| ENV NEXT_PUBLIC_API_URL=/api | |
| RUN npm run build | |
| # Setup entry script | |
| WORKDIR /app | |
| COPY run.sh /app/ | |
| RUN chmod +x /app/run.sh | |
| # Expose HF Spaces port | |
| EXPOSE 7860 | |
| # Next.js will use this PORT variable automatically | |
| ENV PORT=7860 | |
| # Hugging Face Spaces run as a non-root user (uid 1000). | |
| # Give full permissions to /app so SQLite can be created. | |
| RUN chmod -R 777 /app | |
| CMD ["/app/run.sh"] | |