flare / Dockerfile
ciyidogan's picture
Upload 16 files
138ef71 verified
raw
history blame
1.1 kB
# βœ… Base image
FROM python:3.10-slim
# βœ… Install system dependencies
RUN apt-get update && apt-get install -y gcc g++ make
# βœ… Create working directory with write permissions (Hugging Face specific)
WORKDIR /app
RUN mkdir -p /app/.cache /tmp/.triton /tmp/torchinductor_cache && chmod -R 777 /app/.cache /tmp/.triton /tmp/torchinductor_cache
# βœ… Environment variables for Hugging Face caching
ENV HF_HOME=/app/.cache \
HF_DATASETS_CACHE=/app/.cache \
HF_HUB_CACHE=/app/.cache \
TRITON_CACHE_DIR=/tmp/.triton \
TORCHINDUCTOR_CACHE_DIR=/tmp/torchinductor_cache
# βœ… Copy requirements and install
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
# βœ… Copy all project files
COPY . .
# βœ… Expose FastAPI port
EXPOSE 7860
# βœ… Health check dummy server (important for Hugging Face Spaces)
# This will run as a background thread inside Python, not as a separate Docker CMD
# so we only run uvicorn in CMD below.
# βœ… Final startup command
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]