Spaces:
Paused
Paused
Commit
•
4a3f200
1
Parent(s):
60cad88
Create Dockerfile
Browse files- Dockerfile +39 -0
Dockerfile
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Start with a Python image
|
2 |
+
FROM python:latest
|
3 |
+
|
4 |
+
# Set environment variables for Chrome
|
5 |
+
ENV CHROME_BIN=/usr/bin/google-chrome-stable \
|
6 |
+
CHROME_PATH=/usr/local/bin/chromedriver
|
7 |
+
|
8 |
+
# Install Google Chrome
|
9 |
+
RUN apt-get update && apt-get install -y wget gnupg2 unzip \
|
10 |
+
&& wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
|
11 |
+
&& echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list \
|
12 |
+
&& apt-get update \
|
13 |
+
&& apt-get install -y google-chrome-stable --no-install-recommends \
|
14 |
+
&& rm -rf /var/lib/apt/lists/*
|
15 |
+
|
16 |
+
# Install ChromeDriver
|
17 |
+
RUN CHROMEDRIVER_VERSION=`curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE` && \
|
18 |
+
mkdir -p /opt/chromedriver-$CHROMEDRIVER_VERSION && \
|
19 |
+
curl -sS -o /tmp/chromedriver_linux64.zip http://chromedriver.storage.googleapis.com/$CHROMEDRIVER_VERSION/chromedriver_linux64.zip && \
|
20 |
+
unzip -qq /tmp/chromedriver_linux64.zip -d /opt/chromedriver-$CHROMEDRIVER_VERSION && \
|
21 |
+
rm /tmp/chromedriver_linux64.zip && \
|
22 |
+
chmod +x /opt/chromedriver-$CHROMEDRIVER_VERSION/chromedriver && \
|
23 |
+
ln -fs /opt/chromedriver-$CHROMEDRIVER_VERSION/chromedriver /usr/local/bin/chromedriver
|
24 |
+
|
25 |
+
# Set working directory in the container
|
26 |
+
WORKDIR /app
|
27 |
+
|
28 |
+
# Copy requirements.txt and install dependencies
|
29 |
+
COPY ./docker/requirements.txt .
|
30 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
31 |
+
|
32 |
+
# Copy the current directory contents into the container at /app
|
33 |
+
COPY ./app /app
|
34 |
+
|
35 |
+
# Make port 7860 available to the world outside this container
|
36 |
+
EXPOSE 7860
|
37 |
+
|
38 |
+
# Run app.py when the container launches
|
39 |
+
CMD ["python", "app.py"]
|