muddasser commited on
Commit
001c0e8
·
verified ·
1 Parent(s): d2a3bec

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +28 -41
Dockerfile CHANGED
@@ -1,41 +1,28 @@
1
- # Use Python base image
2
- FROM python:3.10-slim
3
-
4
- # Set environment variables
5
- ENV PYTHONDONTWRITEBYTECODE=1
6
- ENV PYTHONUNBUFFERED=1
7
-
8
- # Install system dependencies (Chrome + Chromedriver + others)
9
- RUN apt-get update && apt-get install -y \
10
- wget unzip curl gnupg \
11
- && rm -rf /var/lib/apt/lists/*
12
-
13
- # Install Google Chrome
14
- RUN wget -q https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb \
15
- && apt-get update \
16
- && apt-get install -y ./google-chrome-stable_current_amd64.deb \
17
- && rm google-chrome-stable_current_amd64.deb
18
-
19
- # Install ChromeDriver (match with installed Chrome version)
20
- RUN CHROME_VERSION=$(google-chrome --version | awk '{print $3}') && \
21
- CHROME_MAJOR=$(echo $CHROME_VERSION | cut -d. -f1) && \
22
- wget -q "https://storage.googleapis.com/chrome-for-testing-public/${CHROME_VERSION}/linux64/chromedriver-linux64.zip" -O /tmp/chromedriver.zip && \
23
- unzip /tmp/chromedriver.zip -d /usr/local/bin/ && \
24
- rm /tmp/chromedriver.zip
25
-
26
- # Upgrade pip
27
- RUN pip install --upgrade pip
28
-
29
- # Install Python dependencies
30
- COPY requirements.txt .
31
- RUN pip install -r requirements.txt
32
-
33
- # Copy app
34
- COPY app.py /app/app.py
35
- WORKDIR /app
36
-
37
- # Expose port
38
- EXPOSE 8501
39
-
40
- # Start Streamlit
41
- CMD ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]
 
1
+ FROM python:3.10-slim
2
+
3
+ # Install system dependencies
4
+ RUN apt-get update && apt-get install -y \
5
+ wget unzip curl gnupg \
6
+ chromium chromium-driver \
7
+ && rm -rf /var/lib/apt/lists/*
8
+
9
+ # Set display port to avoid errors
10
+ ENV DISPLAY=:99
11
+
12
+ # Set Chrome binary path
13
+ ENV CHROME_BIN=/usr/bin/chromium
14
+ ENV CHROMEDRIVER_PATH=/usr/bin/chromedriver
15
+
16
+ # Install Python dependencies
17
+ COPY requirements.txt requirements.txt
18
+ RUN pip install --no-cache-dir -r requirements.txt
19
+
20
+ # Copy app code
21
+ COPY . /app
22
+ WORKDIR /app
23
+
24
+ # Expose Streamlit port
25
+ EXPOSE 8501
26
+
27
+ # Run Streamlit app
28
+ CMD ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]