Create Dockerfile
Browse files- Dockerfile +41 -0
Dockerfile
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM python:3.9
|
2 |
+
|
3 |
+
# Install system dependencies for Chrome
|
4 |
+
RUN apt-get update && apt-get install -y \
|
5 |
+
wget \
|
6 |
+
gnupg \
|
7 |
+
unzip \
|
8 |
+
curl \
|
9 |
+
xvfb \
|
10 |
+
&& rm -rf /var/lib/apt/lists/*
|
11 |
+
|
12 |
+
# Install Chrome
|
13 |
+
RUN wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | apt-key add - \
|
14 |
+
&& echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list \
|
15 |
+
&& apt-get update \
|
16 |
+
&& apt-get install -y google-chrome-stable \
|
17 |
+
&& rm -rf /var/lib/apt/lists/*
|
18 |
+
|
19 |
+
# Install ChromeDriver
|
20 |
+
RUN CHROME_DRIVER_VERSION=$(curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE) \
|
21 |
+
&& wget -O /tmp/chromedriver.zip http://chromedriver.storage.googleapis.com//$CHROME_DRIVER_VERSION/chromedriver_linux64.zip \
|
22 |
+
&& unzip /tmp/chromedriver.zip chromedriver -d /usr/local/bin/ \
|
23 |
+
&& rm /tmp/chromedriver.zip \
|
24 |
+
&& chmod +x /usr/local/bin/chromedriver
|
25 |
+
|
26 |
+
# Set display port to avoid crash
|
27 |
+
ENV DISPLAY=:99
|
28 |
+
|
29 |
+
# Install Python dependencies
|
30 |
+
COPY requirements.txt .
|
31 |
+
RUN pip install -r requirements.txt
|
32 |
+
|
33 |
+
# Copy your app
|
34 |
+
COPY . /app
|
35 |
+
WORKDIR /app
|
36 |
+
|
37 |
+
# Expose port
|
38 |
+
EXPOSE 7860
|
39 |
+
|
40 |
+
# Run the application
|
41 |
+
CMD ["python", "app.py"]
|