alidenewade commited on
Commit
6342b98
·
verified ·
1 Parent(s): 29103c9

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +18 -16
Dockerfile CHANGED
@@ -1,30 +1,32 @@
 
1
  FROM python:3.9-slim
2
 
3
- # Set working directory
4
  WORKDIR /app
5
 
6
- # Install system dependencies
 
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 first for better caching
15
- COPY requirements.txt .
16
 
17
- # Install Python dependencies
18
- RUN pip install --no-cache-dir -r requirements.txt
 
19
 
20
- # Copy the application code
21
  COPY . .
22
 
23
- # Expose the port that Streamlit runs on
24
  EXPOSE 7860
25
 
26
- # Health check
27
- HEALTHCHECK CMD curl --fail http://localhost:7860/_stcore/health
28
-
29
- # Command to run the application
30
- ENTRYPOINT ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"]
 
1
+ # Use a slim Python base image
2
  FROM python:3.9-slim
3
 
4
+ # Set the working directory in the container
5
  WORKDIR /app
6
 
7
+ # Install system dependencies needed by RDKit and other libraries *before* anything else.
8
+ # This ensures required libraries like libXrender are available.
9
  RUN apt-get update && apt-get install -y \
10
  build-essential \
11
+ libxrender1 \
12
+ libfontconfig1 \
13
+ libxext6 \
14
  && rm -rf /var/lib/apt/lists/*
15
 
16
+ # Copy the requirements file into the container
17
+ COPY requirements.txt ./requirements.txt
18
 
19
+ # Install the Python dependencies
20
+ RUN pip install --no-cache-dir --upgrade pip && \
21
+ pip install --no-cache-dir -r requirements.txt
22
 
23
+ # Copy the rest of your application's code into the container
24
  COPY . .
25
 
26
+ # Expose the port that Streamlit will run on (Hugging Face default is 7860)
27
  EXPOSE 7860
28
 
29
+ # Command to run the Streamlit app
30
+ # - Add --server.gatherUsageStats=false to prevent the permission error.
31
+ # - The --server.headless=true flag is recommended for containerized environments.
32
+ CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.headless=true", "--server.gatherUsageStats=false"]