MBG0903 commited on
Commit
7c8de1d
·
verified ·
1 Parent(s): 48cc1d5

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +9 -36
Dockerfile CHANGED
@@ -1,55 +1,28 @@
1
- # -------------------------------
2
- # Base image
3
- # -------------------------------
4
  FROM python:3.10-slim
5
 
6
- # -------------------------------
7
- # Environment configs
8
- # -------------------------------
9
  ENV PYTHONDONTWRITEBYTECODE=1
10
  ENV PYTHONUNBUFFERED=1
11
 
12
- # -------------------------------
13
- # System dependencies
14
- # -------------------------------
15
  RUN apt-get update && apt-get install -y \
16
  build-essential \
17
  curl \
18
  && rm -rf /var/lib/apt/lists/*
19
 
20
- # -------------------------------
21
- # Workspace
22
- # -------------------------------
23
  WORKDIR /code
24
 
25
- # -------------------------------
26
- # Install Python dependencies
27
- # -------------------------------
28
  COPY requirements.txt /code/
29
  RUN pip install --no-cache-dir -r requirements.txt
30
 
31
- # -------------------------------
32
- # Copy all project files
33
- # -------------------------------
34
  COPY . /code/
35
 
36
- # -------------------------------
37
- # Streamlit port + environment
38
- # -------------------------------
39
- EXPOSE 7860
40
- ENV PORT=7860
41
  ENV STREAMLIT_SERVER_HEADLESS=true
42
- ENV STREAMLIT_SERVER_PORT=7860
43
  ENV STREAMLIT_SERVER_ADDRESS=0.0.0.0
44
- ENV STREAMLIT_BROWSER_GATHERUSAGESTATS=false
45
-
46
- # -------------------------------
47
- # HEALTH CHECK (important!)
48
- # HF checks this to end "Starting…"
49
- # -------------------------------
50
- HEALTHCHECK CMD curl --fail http://localhost:7860/_stcore/health || exit 1
51
-
52
- # -------------------------------
53
- # Start the Streamlit App
54
- # -------------------------------
55
- CMD ["streamlit", "run", "src/app.py", "--server.port=7860", "--server.address=0.0.0.0"]
 
 
 
 
1
  FROM python:3.10-slim
2
 
 
 
 
3
  ENV PYTHONDONTWRITEBYTECODE=1
4
  ENV PYTHONUNBUFFERED=1
5
 
 
 
 
6
  RUN apt-get update && apt-get install -y \
7
  build-essential \
8
  curl \
9
  && rm -rf /var/lib/apt/lists/*
10
 
 
 
 
11
  WORKDIR /code
12
 
 
 
 
13
  COPY requirements.txt /code/
14
  RUN pip install --no-cache-dir -r requirements.txt
15
 
 
 
 
16
  COPY . /code/
17
 
18
+ # Streamlit must run on 8080 for HuggingFace Docker Spaces
19
+ EXPOSE 8080
20
+ ENV PORT=8080
 
 
21
  ENV STREAMLIT_SERVER_HEADLESS=true
22
+ ENV STREAMLIT_SERVER_PORT=8080
23
  ENV STREAMLIT_SERVER_ADDRESS=0.0.0.0
24
+
25
+ # Healthcheck now checks the correct port
26
+ HEALTHCHECK CMD curl --fail http://localhost:8080/_stcore/health || exit 1
27
+
28
+ CMD ["streamlit", "run", "src/app.py", "--server.port=8080", "--server.address=0.0.0.0"]