Spaces:
Sleeping
Sleeping
Download Dockerfile from erranova/EduPlatform: direct link, hf CLI and curl.
- Browser
- Download file 1.17 kB
-
https://huggingface.co/spaces/erranova/EduPlatform/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/erranova/EduPlatform/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/erranova/EduPlatform/resolve/main/Dockerfile
1.17 kB
| # Stage 1: Build Frontend | |
| FROM node:20-slim AS frontend-builder | |
| WORKDIR /app/frontend | |
| COPY frontend/package*.json ./ | |
| RUN npm install | |
| COPY frontend/ ./ | |
| RUN npm run build | |
| # Stage 2: Backend & Final Image | |
| FROM python:3.11-slim | |
| # Create a non-root user for Hugging Face | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH | |
| WORKDIR $HOME/app | |
| # Install system dependencies | |
| USER root | |
| RUN apt-get update && apt-get install -y \ | |
| libpq-dev \ | |
| gcc \ | |
| && rm -rf /var/lib/apt/lists/* | |
| USER user | |
| # Copy backend requirements | |
| COPY --chown=user:user backend/requirements.txt ./ | |
| RUN pip install --no-cache-dir --user -r requirements.txt | |
| # Copy project files | |
| COPY --chown=user:user . . | |
| # Copy built frontend from Stage 1 | |
| COPY --from=frontend-builder --chown=user:user /app/frontend/dist ./frontend/dist | |
| # Environment variables | |
| ENV PYTHONUNBUFFERED=1 | |
| ENV PORT=7860 | |
| # Port for Hugging Face Spaces | |
| EXPOSE 7860 | |
| # Run migrations and start server | |
| CMD ["sh", "-c", "cd backend && python manage.py migrate --noinput && python manage.py collectstatic --noinput && gunicorn config.wsgi:application --bind 0.0.0.0:7860 --timeout 120"] |