Spaces:
Sleeping
Sleeping
Download Dockerfile from anil988/CodeBlue-Context: direct link, hf CLI and curl.
- Browser
- Download file 1.12 kB
-
https://huggingface.co/spaces/anil988/CodeBlue-Context/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/anil988/CodeBlue-Context/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/anil988/CodeBlue-Context/resolve/main/Dockerfile
1.12 kB
| FROM python:3.9-slim | |
| # Install Node.js for frontend build | |
| RUN apt-get update && apt-get install -y curl && \ | |
| curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \ | |
| apt-get install -y nodejs && \ | |
| rm -rf /var/lib/apt/lists/* | |
| # Hugging Face Spaces require running as a non-root user with ID 1000 | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV PATH="/home/user/.local/bin:$PATH" | |
| WORKDIR /app | |
| # Copy requirements and install Python deps | |
| COPY --chown=user ./requirements.txt requirements.txt | |
| RUN pip install --no-cache-dir --upgrade -r requirements.txt | |
| # Copy frontend source and build | |
| COPY --chown=user frontend/ ./frontend/ | |
| RUN cd frontend && npm install && npm run build | |
| # Copy backend source | |
| COPY --chown=user backend/ ./backend/ | |
| COPY --chown=user codeblue_context.py . | |
| # Copy built frontend to backend static directory | |
| RUN rm -rf backend/static && mkdir -p backend/static && cp -r frontend/dist/* backend/static/ | |
| # Set environment variables for Hugging Face | |
| ENV PORT=7860 | |
| ENV HOST=0.0.0.0 | |
| EXPOSE 7860 | |
| # Run FastAPI server | |
| CMD ["uvicorn", "backend.main:app", "--host", "0.0.0.0", "--port", "7860"] | |