muddasser commited on
Commit
6ea08c5
·
verified ·
1 Parent(s): 5bcbd42

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +6 -21
Dockerfile CHANGED
@@ -17,8 +17,6 @@ RUN apt-get update && apt-get install -y \
17
  libasound2 \
18
  curl \
19
  net-tools \
20
- wget \
21
- unzip \
22
  && rm -rf /var/lib/apt/lists/*
23
 
24
  # Set working directory
@@ -33,7 +31,7 @@ COPY . /app
33
  # Install Python dependencies
34
  RUN pip install --no-cache-dir -r requirements.txt
35
 
36
- # Set environment variables
37
  ENV CHROMEDRIVER_PATH=/usr/bin/chromedriver
38
  ENV CHROMIUM_PATH=/usr/bin/chromium
39
  ENV DISPLAY=:99
@@ -43,25 +41,12 @@ ENV TRANSFORMERS_CACHE=/app/cache
43
  ENV HF_HOME=/app/cache
44
  ENV WDM_CACHE_DIR=/tmp/.wdm
45
 
46
- # Verify ChromeDriver and Chromium are installed and executable
47
- RUN if [ ! -f /usr/bin/chromedriver ]; then \
48
- echo "ChromeDriver not found, installing manually..." && \
49
- wget -q https://storage.googleapis.com/chrome-for-testing-public/120.0.6099.109/linux64/chromedriver-linux64.zip && \
50
- unzip chromedriver-linux64.zip && \
51
- mv chromedriver-linux64/chromedriver /usr/bin/ && \
52
- rm -rf chromedriver-linux64*; \
53
- fi
54
-
55
- RUN if [ ! -f /usr/bin/chromium ]; then \
56
- echo "Chromium not found, creating symlink..." && \
57
- ln -s /usr/bin/chromium-browser /usr/bin/chromium; \
58
- fi
59
-
60
- # Ensure ChromeDriver and Chromium are executable
61
- RUN chmod +x /usr/bin/chromedriver /usr/bin/chromium
62
 
63
  # Expose Streamlit port
64
  EXPOSE 8501
65
 
66
- # Run Streamlit with headless mode and disabled file watcher
67
- CMD ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0", "--server.fileWatcherType=none", "--server.headless=true"]
 
17
  libasound2 \
18
  curl \
19
  net-tools \
 
 
20
  && rm -rf /var/lib/apt/lists/*
21
 
22
  # Set working directory
 
31
  # Install Python dependencies
32
  RUN pip install --no-cache-dir -r requirements.txt
33
 
34
+ # Set environment variables (update according to installed binaries)
35
  ENV CHROMEDRIVER_PATH=/usr/bin/chromedriver
36
  ENV CHROMIUM_PATH=/usr/bin/chromium
37
  ENV DISPLAY=:99
 
41
  ENV HF_HOME=/app/cache
42
  ENV WDM_CACHE_DIR=/tmp/.wdm
43
 
44
+ # Ensure ChromeDriver and Chromium are executable (only if they exist)
45
+ RUN if [ -f /usr/bin/chromedriver ]; then chmod +x /usr/bin/chromedriver; fi && \
46
+ if [ -f /usr/bin/chromium ]; then chmod +x /usr/bin/chromium; fi
 
 
 
 
 
 
 
 
 
 
 
 
 
47
 
48
  # Expose Streamlit port
49
  EXPOSE 8501
50
 
51
+ # Run Streamlit
52
+ CMD ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0", "--server.fileWatcherType=none", "--server.headless=true"]