|
|
|
FROM python:3.12.2 |
|
|
|
|
|
ENV DEBIAN_FRONTEND=noninteractive |
|
ENV TZ=UTC |
|
|
|
|
|
RUN apt-get update && apt-get install -y \ |
|
ffmpeg \ |
|
git \ |
|
curl \ |
|
build-essential \ |
|
cargo \ |
|
pkg-config \ |
|
libssl-dev \ |
|
&& rm -rf /var/lib/apt/lists/* |
|
|
|
|
|
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y |
|
ENV PATH="/root/.cargo/bin:${PATH}" |
|
|
|
|
|
WORKDIR /app |
|
|
|
|
|
COPY . /app |
|
|
|
|
|
RUN pip install --no-cache-dir -U pip setuptools wheel |
|
RUN pip install --no-cache-dir setuptools-rust |
|
RUN pip install --no-cache-dir torch==2.0.1+cu118 torchaudio==2.0.2+cu118 -f https://download.pytorch.org/whl/torch_stable.html |
|
RUN pip install --no-cache-dir -r requirements.txt |
|
|
|
|
|
RUN useradd -m -u 1000 user |
|
USER user |
|
|
|
|
|
COPY --chown=user . /app/ |
|
|
|
|
|
ENV TORCH_DEVICE="cuda" |
|
ENV FORCE_FP32="false" |
|
|
|
|
|
EXPOSE 7860 |
|
|
|
|
|
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "5"] |
|
|