lanzhiwang's picture
Dockerfile
d1fd369
FROM docker.io/library/python:3.10
RUN useradd -m -u 1000 user
WORKDIR /home/user/app
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" streamlit==1.29.0 "uvicorn>=0.14.0" spaces==0.18.0 -i https://pypi.tuna.tsinghua.edu.cn/simple
RUN apt-get update && apt-get install -y git git-lfs ffmpeg libsm6 libxext6 cmake libgl1-mesa-glx && rm -rf /var/lib/apt/lists/* && git lfs install
COPY --chown=1000 ./ /home/user/app
RUN if [ -f ./packages.txt ]; then \
apt-get update && xargs -r -a ./packages.txt apt-get install -y && rm -rf /var/lib/apt/lists/*; \
else \
echo "packages.txt not found!"; \
fi
RUN if [ -f .pre-requirements.txt ]; then \
pip install --no-cache-dir -r ./pre-requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple; \
else \
echo "pre-requirements.txt not found!"; \
fi
RUN if [ -f ./requirements.txt ]; then \
pip install --no-cache-dir -r ./requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple; \
else \
echo "requirements.txt not found!"; \
fi
ENV PYTHONUNBUFFERED=1
EXPOSE 8501
ENTRYPOINT ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]