| # Simplified Dockerfile for Hugging Face Spaces | |
| FROM python:3.11-slim | |
| # Install minimal system dependencies | |
| RUN apt-get update && apt-get install -y \ | |
| xvfb \ | |
| x11vnc \ | |
| websockify \ | |
| novnc \ | |
| fluxbox \ | |
| xterm \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Set up noVNC | |
| RUN mkdir -p /opt/novnc \ | |
| && ln -s /usr/share/novnc/vnc.html /opt/novnc/index.html | |
| # Create app directory | |
| WORKDIR /app | |
| # Copy requirements first for better caching | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy application code | |
| COPY app.py . | |
| COPY vnc_server.py . | |
| COPY auth.py . | |
| # Create non-root user | |
| RUN useradd -m -u 1000 appuser && chown -R appuser:appuser /app | |
| USER appuser | |
| # Expose port (Hugging Face uses 7860) | |
| EXPOSE 7860 | |
| # Start command | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] |