|
FROM ubuntu:22.04 AS stage1 |
|
|
|
|
|
RUN apt-get update && \ |
|
apt-get install -y python3.10 python3-pip |
|
|
|
|
|
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.10 1 && \ |
|
update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1 |
|
|
|
|
|
RUN pip install --no-cache-dir pip==22.3.1 && \ |
|
pip install --no-cache-dir \ |
|
datasets \ |
|
"huggingface-hub>=0.19" "hf-transfer>=0.1.4" "protobuf<4" "click<8.1" "pydantic~=1.0" |
|
|
|
|
|
RUN apt-get install -y \ |
|
git \ |
|
git-lfs \ |
|
ffmpeg \ |
|
libsm6 \ |
|
libxext6 \ |
|
cmake \ |
|
libgl1-mesa-glx \ |
|
&& git lfs install \ |
|
&& rm -rf /var/lib/apt/lists/* |
|
|
|
FROM stage1 AS stage2 |
|
|
|
|
|
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 |
|
|
|
|
|
COPY requirements.txt requirements.txt |
|
RUN pip install --no-cache-dir -r requirements.txt |
|
|
|
FROM stage2 AS stage3 |
|
|
|
|
|
RUN pip install --no-cache-dir \ |
|
gradio[oauth]==4.27.0 \ |
|
"uvicorn>=0.14.0" |
|
|
|
FROM stage3 AS stage4 |
|
|
|
WORKDIR /home/user/app |
|
|
|
COPY --chown=1000:1000 . /home/user/app |
|
|
|
ENTRYPOINT ["python", "app.py"] |