Akayl
single-space deploy: serve frontend + backend together
f6e9e3f
Raw
History Blame Contribute Delete
707 Bytes
FROM python:3.10-slim
WORKDIR /app
# HF Spaces run the container as a non-root user; give the HF cache a writable home
# so the model download at startup doesn't hit a permissions error.
ENV HF_HOME=/app/.cache \
TRANSFORMERS_CACHE=/app/.cache \
PYTHONUNBUFFERED=1
# System lib required by opencv-python-headless (libgthread).
RUN apt-get update \
&& apt-get install -y --no-install-recommends libglib2.0-0 \
&& rm -rf /var/lib/apt/lists/*
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY app.py .
COPY static/ static/
RUN mkdir -p /app/.cache && chmod -R 777 /app/.cache
EXPOSE 7860
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]