lanzhiwang commited on
Commit
d1fd369
1 Parent(s): d2d75a3

Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +24 -16
Dockerfile CHANGED
@@ -1,27 +1,35 @@
1
- # app/Dockerfile
2
 
3
- FROM python:3.10-bullseye
4
 
5
- WORKDIR /app
6
 
7
- RUN apt-get update && apt-get install -y \
8
- build-essential \
9
- curl \
10
- software-properties-common \
11
- git \
12
- && rm -rf /var/lib/apt/lists/*
13
 
14
- COPY requirements.txt requirements.txt
15
 
16
- RUN pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
17
 
18
- COPY app.py app.py
19
- COPY .streamlit .streamlit
 
 
 
20
 
21
- EXPOSE 7860
 
 
 
 
 
 
 
 
 
 
22
 
23
  ENV PYTHONUNBUFFERED=1
24
 
25
- HEALTHCHECK CMD curl --fail http://localhost:7860/_stcore/health
26
 
27
- ENTRYPOINT ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"]
 
1
+ FROM docker.io/library/python:3.10
2
 
3
+ RUN useradd -m -u 1000 user
4
 
5
+ WORKDIR /home/user/app
6
 
7
+ 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
 
 
 
 
 
8
 
9
+ 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
10
 
11
+ COPY --chown=1000 ./ /home/user/app
12
 
13
+ RUN if [ -f ./packages.txt ]; then \
14
+ apt-get update && xargs -r -a ./packages.txt apt-get install -y && rm -rf /var/lib/apt/lists/*; \
15
+ else \
16
+ echo "packages.txt not found!"; \
17
+ fi
18
 
19
+ RUN if [ -f .pre-requirements.txt ]; then \
20
+ pip install --no-cache-dir -r ./pre-requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple; \
21
+ else \
22
+ echo "pre-requirements.txt not found!"; \
23
+ fi
24
+
25
+ RUN if [ -f ./requirements.txt ]; then \
26
+ pip install --no-cache-dir -r ./requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple; \
27
+ else \
28
+ echo "requirements.txt not found!"; \
29
+ fi
30
 
31
  ENV PYTHONUNBUFFERED=1
32
 
33
+ EXPOSE 8501
34
 
35
+ ENTRYPOINT ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]