Spaces:
Paused
Paused
| # Read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker | |
| # you will also find guides on how best to write your Dockerfile | |
| FROM python:3.9 | |
| # Install code-server and other dependencies | |
| RUN apt-get update && apt-get install -y \ | |
| curl \ | |
| wget \ | |
| git \ | |
| nodejs \ | |
| npm \ | |
| supervisor \ | |
| && curl -fsSL https://code-server.dev/install.sh | sh \ | |
| && apt-get clean \ | |
| && rm -rf /var/lib/apt/lists/* | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV PATH="/home/user/.local/bin:$PATH" | |
| WORKDIR /app | |
| # Copy requirements and install Python dependencies | |
| COPY --chown=user ./requirements.txt requirements.txt | |
| RUN pip install --no-cache-dir --upgrade -r requirements.txt | |
| # Copy application files | |
| COPY --chown=user . /app | |
| # Create workspace directory for code-server | |
| RUN mkdir -p /home/user/workspace | |
| # Switch to root to set up supervisor | |
| USER root | |
| # Create supervisor configuration | |
| RUN mkdir -p /etc/supervisor/conf.d | |
| COPY --chown=root supervisord.conf /etc/supervisor/conf.d/supervisord.conf | |
| # Switch back to user | |
| USER user | |
| # Expose port 7860 (HF Spaces standard port) | |
| EXPOSE 7860 | |
| # Start supervisor which will manage both FastAPI and code-server | |
| CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"] |