hamza2923 commited on
Commit
d741b57
·
verified ·
1 Parent(s): 566327c

Create dockerfile

Browse files
Files changed (1) hide show
  1. dockerfile +39 -0
dockerfile ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use Python 3.9 slim
2
+ FROM python:3.9-slim
3
+
4
+ # Install system dependencies
5
+ RUN apt-get update && apt-get install -y \
6
+ wget \
7
+ gnupg \
8
+ && rm -rf /var/lib/apt/lists/*
9
+
10
+ # Install Chrome
11
+ RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
12
+ && echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list \
13
+ && apt-get update \
14
+ && apt-get install -y google-chrome-stable \
15
+ && rm -rf /var/lib/apt/lists/*
16
+
17
+ # Install ChromeDriver
18
+ RUN CHROME_VERSION=$(google-chrome --version | awk '{print $3}' | cut -d '.' -f 1) \
19
+ && CHROMEDRIVER_VERSION=$(wget -qO- https://chromedriver.storage.googleapis.com/LATEST_RELEASE_${CHROME_VERSION}) \
20
+ && wget -O /tmp/chromedriver.zip https://chromedriver.storage.googleapis.com/${CHROMEDRIVER_VERSION}/chromedriver_linux64.zip \
21
+ && unzip /tmp/chromedriver.zip -d /usr/bin/ \
22
+ && rm /tmp/chromedriver.zip \
23
+ && chmod +x /usr/bin/chromedriver
24
+
25
+ # Set up app directory
26
+ WORKDIR /app
27
+
28
+ # Copy requirements and install
29
+ COPY requirements.txt .
30
+ RUN pip install --no-cache-dir -r requirements.txt
31
+
32
+ # Copy app
33
+ COPY app.py .
34
+
35
+ # Set environment variable for port
36
+ ENV PORT=7860
37
+
38
+ # Run the app
39
+ CMD ["python", "app.py"]