Álvaro Valenzuela Valdes
deploy: Add unified Docker deployment files for Hugging Face Spaces
f59c380 | # Build Frontend | |
| FROM node:20-slim AS frontend-builder | |
| WORKDIR /app/frontend | |
| COPY frontend/package.json frontend/package-lock.json* ./ | |
| RUN npm install | |
| COPY frontend/ . | |
| # Set API base to empty so it uses relative paths (handled by Nginx) | |
| ENV NEXT_PUBLIC_API_BASE="" | |
| RUN npm run build | |
| # Final Image | |
| FROM python:3.12-slim | |
| WORKDIR /app | |
| # Install Node.js (for running frontend in dev/ssr mode) and Nginx | |
| RUN apt-get update && apt-get install -y \ | |
| curl \ | |
| nginx \ | |
| && curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \ | |
| && apt-get install -y nodejs \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Copy Backend | |
| COPY backend/requirements.txt ./backend/ | |
| RUN pip install --no-cache-dir -r backend/requirements.txt | |
| # Install missing deps found earlier | |
| RUN pip install --no-cache-dir sqlalchemy==2.0.49 pymysql cryptography | |
| COPY backend/ ./backend/ | |
| # Copy Frontend Build | |
| COPY --from=frontend-builder /app/frontend/.next ./frontend/.next | |
| COPY --from=frontend-builder /app/frontend/public ./frontend/public | |
| COPY --from=frontend-builder /app/frontend/package.json ./frontend/package.json | |
| COPY --from=frontend-builder /app/frontend/node_modules ./frontend/node_modules | |
| # Nginx Config | |
| COPY nginx.conf /etc/nginx/sites-available/default | |
| # Start Script | |
| COPY start.sh . | |
| RUN chmod +x start.sh | |
| # Expose HF Port | |
| EXPOSE 7860 | |
| CMD ["./start.sh"] | |