|
|
|
FROM docker.io/nvidia/cuda:12.3.2-cudnn9-devel-ubuntu22.04@sha256:fb1ad20f2552f5b3aafb2c9c478ed57da95e2bb027d15218d7a55b3a0e4b4413 |
|
|
|
|
|
ENV DEBIAN_FRONTEND=noninteractive |
|
ENV TZ=UTC |
|
|
|
|
|
RUN apt-get update && apt-get install -y \ |
|
python3 python3-pip python3-dev \ |
|
&& rm -rf /var/lib/apt/lists/* |
|
|
|
|
|
RUN apt-get update && apt-get install -y fakeroot && \ |
|
mv /usr/bin/apt-get /usr/bin/.apt-get && \ |
|
echo '#!/usr/bin/env sh\nfakeroot /usr/bin/.apt-get $@' > /usr/bin/apt-get && \ |
|
chmod +x /usr/bin/apt-get && \ |
|
rm -rf /var/lib/apt/lists/* && \ |
|
useradd -m -u 1000 user |
|
|
|
|
|
WORKDIR /home/user/app |
|
|
|
|
|
COPY requirements.txt /tmp/requirements.txt |
|
RUN pip install --no-cache-dir -r /tmp/requirements.txt |
|
|
|
|
|
RUN pip install --no-cache-dir spaces |
|
|
|
|
|
RUN pip install --no-cache-dir huggingface_hub |
|
|
|
|
|
RUN --mount=type=secret,id=HF_TOKEN,mode=0444,required=true \ |
|
echo "export HF_TOKEN=$(cat /run/secrets/HF_TOKEN)" > /etc/hf_env && \ |
|
chmod +x /etc/hf_env |
|
|
|
|
|
RUN echo '#!/bin/bash\nsource /etc/hf_env\nexec "$@"' > /usr/local/bin/entrypoint.sh && \ |
|
chmod +x /usr/local/bin/entrypoint.sh |
|
|
|
|
|
COPY --chown=1000:1000 app.py /home/user/app/ |
|
COPY --chown=1000:1000 pipeline_difix.py /home/user/app/ |
|
COPY --chown=1000:1000 assets/ /home/user/app/assets/ |
|
|
|
|
|
USER user |
|
|
|
|
|
EXPOSE 7860 |
|
|
|
|
|
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] |
|
CMD ["python3", "app.py"] |