alidenewade commited on
Commit
32497b2
·
verified ·
1 Parent(s): 682e606

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +13 -8
Dockerfile CHANGED
@@ -4,7 +4,7 @@ FROM python:3.9-slim
4
  # Set working directory
5
  WORKDIR /app
6
 
7
- # Install system dependencies
8
  RUN apt-get update && apt-get install -y \
9
  gcc \
10
  g++ \
@@ -17,26 +17,31 @@ RUN apt-get update && apt-get install -y \
17
  libfontconfig1 \
18
  libcairo2-dev \
19
  libpango1.0-dev \
20
- libgdk-pixbuf-xlib-2.0-dev \
21
  libgtk-3-dev \
22
- libxrender-dev \
23
  && rm -rf /var/lib/apt/lists/*
24
 
25
- # Copy requirements first
26
  COPY requirements.txt .
27
 
28
  # Install Python dependencies
29
- RUN pip cache purge && pip install --no-cache-dir -r requirements.txt
30
 
31
  # Copy the application code
32
  COPY . .
33
 
34
- # Create a non-root user
35
  RUN useradd -m -u 1000 appuser && chown -R appuser:appuser /app
36
  USER appuser
37
 
38
- # Expose the port
39
  EXPOSE 7860
40
 
 
 
 
 
 
 
41
  # Command to run the application
42
- CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"]
 
4
  # Set working directory
5
  WORKDIR /app
6
 
7
+ # Install system dependencies required for RDKit and other packages
8
  RUN apt-get update && apt-get install -y \
9
  gcc \
10
  g++ \
 
17
  libfontconfig1 \
18
  libcairo2-dev \
19
  libpango1.0-dev \
20
+ libgdk-pixbuf2.0-dev \
21
  libgtk-3-dev \
 
22
  && rm -rf /var/lib/apt/lists/*
23
 
24
+ # Copy requirements first for better Docker layer caching
25
  COPY requirements.txt .
26
 
27
  # Install Python dependencies
28
+ RUN pip install --no-cache-dir -r requirements.txt
29
 
30
  # Copy the application code
31
  COPY . .
32
 
33
+ # Create a non-root user for security
34
  RUN useradd -m -u 1000 appuser && chown -R appuser:appuser /app
35
  USER appuser
36
 
37
+ # Expose the port that Streamlit uses
38
  EXPOSE 7860
39
 
40
+ # Set environment variables for Streamlit
41
+ ENV STREAMLIT_SERVER_ADDRESS=0.0.0.0
42
+ ENV STREAMLIT_SERVER_PORT=7860
43
+ ENV STREAMLIT_SERVER_HEADLESS=true
44
+ ENV STREAMLIT_BROWSER_GATHER_USAGE_STATS=false
45
+
46
  # Command to run the application
47
+ CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"]