allbgremove-api / Dockerfile
manojkumarsh's picture
Add einops to requirements and fix HF cache permissions in Dockerfile
bd83703 verified
Raw History Blame Contribute Delete
671 Bytes
FROM python:3.10
WORKDIR /app
RUN apt-get update && apt-get install -y ffmpeg libgl1 libglib2.0-0 && rm -rf /var/lib/apt/lists/*
# Force install PyTorch CPU wheels explicitly
RUN pip install --no-cache-dir torch torchvision --extra-index-url https://download.pytorch.org/whl/cpu
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Set cache directories to an accessible location within the app
ENV HF_HOME=/app/cache
ENV TRANSFORMERS_CACHE=/app/cache
COPY . .
# Create cache directory and grant permissions
RUN mkdir -p /app/cache && chmod -R 777 /app/cache
EXPOSE 7860
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]