Hair_stable_new / Dockerfile
LogicGoInfotechSpaces's picture
chore(space): Dockerize FastAPI app; avoid Gradio/xformers on server; add README
e5f91f5
raw
history blame
863 Bytes
# syntax=docker/dockerfile:1
FROM python:3.10-slim
ENV PIP_NO_CACHE_DIR=1 \
PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
HF_HUB_ENABLE_HF_TRANSFER=1
WORKDIR /app
# System deps
RUN apt-get update && apt-get install -y --no-install-recommends \
git \
gcc \
libgl1 \
&& rm -rf /var/lib/apt/lists/*
# Copy code
COPY . /app
# Install deps
RUN python -m pip install --upgrade pip && \
python -m pip install -r requirements.txt && \
# CPU-only torch to avoid CUDA/xformers issues on Spaces CPU images
python -m pip install --index-url https://download.pytorch.org/whl/cpu torch torchvision torchaudio --upgrade --force-reinstall && \
# Ensure xformers is not installed
python -m pip uninstall -y xformers || true
EXPOSE 7860
CMD ["python", "-m", "uvicorn", "server:app", "--host", "0.0.0.0", "--port", "7860"]