isolated-sandbox / Dockerfile
ChefAdorous's picture
Configure for Hugging Face Spaces with Docker SDK and add limitations notice
6ae3186
raw
history blame contribute delete
963 Bytes
# Hugging Face Spaces Dockerfile
# Note: This Space has LIMITED functionality because HF Spaces doesn't support Docker-in-Docker
# Session management and file operations require Docker and won't work here
# Only the stateless /execute endpoint will function
FROM python:3.11-slim
# Install system dependencies
RUN apt-get update && apt-get install -y \
curl \
&& rm -rf /var/lib/apt/lists/*
# Create user
RUN useradd -m -u 1000 user
USER user
ENV PATH="/home/user/.local/bin:$PATH"
WORKDIR /app
# Copy requirements and install
COPY --chown=user ./requirements.txt requirements.txt
RUN pip install --no-cache-dir --upgrade -r requirements.txt
# Copy application code
COPY --chown=user . /app
# Expose port
EXPOSE 7860
# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD curl -f http://localhost:7860/health || exit 1
# Run the application
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]