|
|
|
FROM pytorch/pytorch:2.2.2-cuda12.1-cudnn8-runtime |
|
|
|
|
|
RUN apt-get update && \ |
|
apt-get install -y --no-install-recommends \ |
|
git \ |
|
git-lfs \ |
|
build-essential \ |
|
ffmpeg \ |
|
curl \ |
|
wget && \ |
|
rm -rf /var/lib/apt/lists/* |
|
|
|
|
|
RUN useradd -m -u 1000 user |
|
USER user |
|
WORKDIR /app |
|
|
|
|
|
ENV PATH="/home/user/.local/bin:$PATH" |
|
ENV HF_HOME=/app/.cache |
|
ENV PYTHONPATH="/app:$PYTHONPATH" |
|
|
|
|
|
COPY --chown=user . /app |
|
|
|
|
|
RUN pip install --upgrade pip |
|
|
|
|
|
COPY --chown=user requirements.txt . |
|
RUN pip install -r requirements.txt |
|
|
|
|
|
RUN pip install --no-cache-dir flash-attn --no-build-isolation || echo "Flash attention not available, continuing..." |
|
|
|
|
|
EXPOSE 7860 |
|
|
|
|
|
ENV PYTHONUNBUFFERED=1 |
|
ENV UVICORN_HOST=0.0.0.0 |
|
ENV UVICORN_PORT=7860 |
|
|
|
|
|
HEALTHCHECK --interval=30s --timeout=30s --start-period=60s --retries=3 \ |
|
CMD curl -f http://localhost:7860/health || exit 1 |
|
|
|
|
|
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] |