lp128396 commited on
Commit
e1b6b80
Β·
verified Β·
1 Parent(s): 87f9339

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +16 -5
Dockerfile CHANGED
@@ -1,25 +1,36 @@
1
  FROM python:3.9-slim
2
 
 
3
  ENV PYTHONUNBUFFERED=1 \
4
  PORT=8501 \
5
  HF_HOME=/tmp/huggingface \
6
- STREAMLIT_CONFIG_DIR=/tmp/.streamlit
 
 
 
 
 
7
  WORKDIR /app
8
 
 
9
  RUN apt-get update && apt-get install -y \
10
  build-essential \
11
  curl \
12
- software-properties-common \
13
  git \
14
  && rm -rf /var/lib/apt/lists/*
15
 
 
16
  COPY requirements.txt ./
17
  COPY src/ ./src/
18
 
19
- RUN pip3 install -r requirements.txt
 
20
 
 
21
  EXPOSE 8501
22
 
23
- HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
 
24
 
25
- ENTRYPOINT ["streamlit", "run", "src/app.py", "--server.port=8501", "--server.address=0.0.0.0"]
 
 
1
  FROM python:3.9-slim
2
 
3
+ # βœ… Safe writable envs
4
  ENV PYTHONUNBUFFERED=1 \
5
  PORT=8501 \
6
  HF_HOME=/tmp/huggingface \
7
+ STREAMLIT_HOME=/tmp/.streamlit \
8
+ STREAMLIT_CONFIG_DIR=/tmp/.streamlit \
9
+ STREAMLIT_SERVER_HEADLESS=true \
10
+ STREAMLIT_SERVER_PORT=8501 \
11
+ STREAMLIT_SERVER_ADDRESS=0.0.0.0
12
+
13
  WORKDIR /app
14
 
15
+ # βœ… Install system dependencies
16
  RUN apt-get update && apt-get install -y \
17
  build-essential \
18
  curl \
 
19
  git \
20
  && rm -rf /var/lib/apt/lists/*
21
 
22
+ # βœ… Copy files
23
  COPY requirements.txt ./
24
  COPY src/ ./src/
25
 
26
+ # βœ… Install Python packages
27
+ RUN pip install --no-cache-dir -r requirements.txt
28
 
29
+ # βœ… Expose Streamlit port
30
  EXPOSE 8501
31
 
32
+ # βœ… Healthcheck for Hugging Face Spaces
33
+ HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
34
 
35
+ # βœ… Run Streamlit
36
+ ENTRYPOINT ["streamlit", "run", "src/app.py"]