|
|
|
|
|
FROM python:3.9-slim |
|
|
|
|
|
|
|
|
RUN apt-get update && \ |
|
|
apt-get install -y --no-install-recommends \ |
|
|
build-essential \ |
|
|
gcc \ |
|
|
git \ |
|
|
ffmpeg \ |
|
|
libsndfile1 \ |
|
|
libgomp1 \ |
|
|
curl && \ |
|
|
rm -rf /var/lib/apt/lists/* |
|
|
|
|
|
|
|
|
ENV PYTHONDONTWRITEBYTECODE=1 \ |
|
|
PYTHONUNBUFFERED=1 \ |
|
|
HF_HOME=/tmp/huggingface \ |
|
|
TRANSFORMERS_CACHE=/tmp/huggingface/transformers \ |
|
|
HF_HUB_CACHE=/tmp/huggingface/hub \ |
|
|
HF_DATASETS_CACHE=/tmp/huggingface/datasets \ |
|
|
XDG_CACHE_HOME=/tmp/huggingface |
|
|
|
|
|
WORKDIR /app |
|
|
|
|
|
|
|
|
COPY requirements.txt /app/requirements.txt |
|
|
RUN pip install --no-cache-dir --upgrade pip && \ |
|
|
pip install --no-cache-dir -r /app/requirements.txt |
|
|
|
|
|
|
|
|
RUN useradd -m -u 1000 user |
|
|
USER user |
|
|
ENV PATH="/home/user/.local/bin:$PATH" |
|
|
|
|
|
|
|
|
COPY --chown=user:root . /app |
|
|
|
|
|
|
|
|
EXPOSE 7860 |
|
|
|
|
|
|
|
|
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1", "--timeout-keep-alive", "120"] |
|
|
|