muddasser commited on
Commit
a26913a
·
verified ·
1 Parent(s): bdf505b

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +9 -6
Dockerfile CHANGED
@@ -26,7 +26,8 @@ WORKDIR /app
26
 
27
  # Create cache directories with proper permissions
28
  RUN mkdir -p /app/cache/pip /tmp/.wdm /tmp/chrome-data && \
29
- chmod -R 777 /app/cache /tmp/.wdm /tmp/chrome-data
 
30
 
31
  # Set pip cache directory
32
  ENV XDG_CACHE_HOME=/app/cache/pip
@@ -45,6 +46,9 @@ RUN pip install --upgrade pip && \
45
  RUN python -c "import transformers; from transformers import pipeline; print('Transformers pipeline imported successfully, version:', transformers.__version__)" && \
46
  python -c "import tokenizers; print('Tokenizers imported successfully, version:', tokenizers.__version__)"
47
 
 
 
 
48
  # Copy the rest of the application
49
  COPY . .
50
 
@@ -56,13 +60,12 @@ ENV PYTHONUNBUFFERED=1
56
  ENV STREAMLIT_OPT_OUT_OF_USAGE_STATISTICS=true
57
  ENV HF_HOME=/app/cache
58
  ENV WDM_CACHE_DIR=/tmp/.wdm
59
- ENV CHROME_USER_DATA_DIR=/tmp/chrome-data
60
 
61
  # Ensure ChromeDriver and Chromium are executable
62
  RUN chmod +x /usr/bin/chromedriver /usr/bin/chromium
63
 
64
- # Expose Streamlit port
65
- EXPOSE 8501
66
 
67
- # Run Streamlit
68
- CMD ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0", "--server.fileWatcherType=none", "--server.headless=true"]
 
26
 
27
  # Create cache directories with proper permissions
28
  RUN mkdir -p /app/cache/pip /tmp/.wdm /tmp/chrome-data && \
29
+ chmod -R 777 /app/cache /tmp/.wdm /tmp/chrome-data && \
30
+ rm -rf /tmp/* # Clear /tmp at build time
31
 
32
  # Set pip cache directory
33
  ENV XDG_CACHE_HOME=/app/cache/pip
 
46
  RUN python -c "import transformers; from transformers import pipeline; print('Transformers pipeline imported successfully, version:', transformers.__version__)" && \
47
  python -c "import tokenizers; print('Tokenizers imported successfully, version:', tokenizers.__version__)"
48
 
49
+ # Verify ChromeDriver
50
+ RUN chromedriver --version && chromium --version
51
+
52
  # Copy the rest of the application
53
  COPY . .
54
 
 
60
  ENV STREAMLIT_OPT_OUT_OF_USAGE_STATISTICS=true
61
  ENV HF_HOME=/app/cache
62
  ENV WDM_CACHE_DIR=/tmp/.wdm
 
63
 
64
  # Ensure ChromeDriver and Chromium are executable
65
  RUN chmod +x /usr/bin/chromedriver /usr/bin/chromium
66
 
67
+ # Clear /tmp at container startup
68
+ CMD ["sh", "-c", "rm -rf /tmp/* && chmod -R 777 /tmp && streamlit run app.py --server.port=8501 --server.address=0.0.0.0 --server.fileWatcherType=none --server.headless=true"]
69
 
70
+ # Expose Streamlit port
71
+ EXPOSE 8501