handex commited on
Commit
70a274e
·
1 Parent(s): a121540

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +19 -33
Dockerfile CHANGED
@@ -1,47 +1,33 @@
1
- # Dockerfile optimized for Hugging Face Space
2
-
3
  FROM python:3.11-slim
4
 
5
- # Set working directory
6
-
7
  WORKDIR /app
8
 
9
- # Install system dependencies
 
 
10
 
11
  RUN apt-get update && apt-get install -y \
12
- build-essential \
13
- curl \
14
- git \
15
- libglib2.0-0 \
16
- libsm6 \
17
- libxext6 \
18
- libxrender1 \
19
- libffi-dev \
20
- libssl-dev \
21
- libstdc++6 && \
22
- rm -rf /var/lib/apt/lists/*
23
-
24
- # Copy source code and requirements
25
 
26
- COPY src/ ./src
27
  COPY requirements.txt .
28
 
29
- # Upgrade pip
30
-
31
- RUN pip install --upgrade pip
32
 
33
- # Install dependencies while ignoring pre-installed system packages
34
-
35
- RUN pip install --ignore-installed -r requirements.txt
36
-
37
- # Expose Streamlit port
38
 
39
  EXPOSE 8501
40
 
41
- # Healthcheck
42
-
43
- HEALTHCHECK CMD curl --fail [http://localhost:8501/_stcore/health](http://localhost:8501/_stcore/health) || exit 1
44
-
45
- # Entry point
46
 
47
- ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0", "--server.enableXsrfProtection=false"]
 
 
 
1
  FROM python:3.11-slim
2
 
 
 
3
  WORKDIR /app
4
 
5
+ ENV TF_USE_LEGACY_KERAS=1
6
+
7
+ ENV PYTHONUNBUFFERED=1
8
 
9
  RUN apt-get update && apt-get install -y \
10
+ build-essential \
11
+ curl \
12
+ git \
13
+ libglib2.0-0 \
14
+ libsm6 \
15
+ libxext6 \
16
+ libxrender1 \
17
+ libffi-dev \
18
+ libssl-dev \
19
+ libstdc++6 && \
20
+ rm -rf /var/lib/apt/lists/*
 
 
21
 
 
22
  COPY requirements.txt .
23
 
24
+ RUN pip install --upgrade pip && \
25
+ pip install --no-cache-dir -r requirements.txt
 
26
 
27
+ COPY src/ ./src
 
 
 
 
28
 
29
  EXPOSE 8501
30
 
31
+ HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
 
 
 
 
32
 
33
+ ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0", "--server.enableXsrfProtection=false"]