Spaces:
Runtime error
Runtime error
Create Dockerfile
Browse files- Dockerfile +68 -0
Dockerfile
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use Python 3.10 slim base image
|
| 2 |
+
FROM python:3.10-slim
|
| 3 |
+
|
| 4 |
+
# Set working directory
|
| 5 |
+
WORKDIR /app
|
| 6 |
+
|
| 7 |
+
# Install system dependencies + Chrome (required for ChromeDriver to run)
|
| 8 |
+
RUN apt-get update && apt-get install -y \
|
| 9 |
+
wget \
|
| 10 |
+
gnupg \
|
| 11 |
+
curl \
|
| 12 |
+
unzip \
|
| 13 |
+
libglib2.0-0 \
|
| 14 |
+
libnss3 \
|
| 15 |
+
libgconf-2-4 \
|
| 16 |
+
libfontconfig1 \
|
| 17 |
+
libx11-6 \
|
| 18 |
+
libx11-xcb1 \
|
| 19 |
+
libxcb1 \
|
| 20 |
+
libxcomposite1 \
|
| 21 |
+
libxcursor1 \
|
| 22 |
+
libxdamage1 \
|
| 23 |
+
libxext6 \
|
| 24 |
+
libxfixes3 \
|
| 25 |
+
libxi6 \
|
| 26 |
+
libxrandr2 \
|
| 27 |
+
libxrender1 \
|
| 28 |
+
libxtst6 \
|
| 29 |
+
ca-certificates \
|
| 30 |
+
fonts-liberation \
|
| 31 |
+
libappindicator3-1 \
|
| 32 |
+
libasound2 \
|
| 33 |
+
libatk-bridge2.0-0 \
|
| 34 |
+
libatk1.0-0 \
|
| 35 |
+
libcups2 \
|
| 36 |
+
libdbus-1-3 \
|
| 37 |
+
libdrm2 \
|
| 38 |
+
libgbm1 \
|
| 39 |
+
libgtk-3-0 \
|
| 40 |
+
libnspr4 \
|
| 41 |
+
libpango-1.0-0 \
|
| 42 |
+
libxss1 \
|
| 43 |
+
xdg-utils \
|
| 44 |
+
lsb-release \
|
| 45 |
+
xz-utils \
|
| 46 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 47 |
+
|
| 48 |
+
# Install Google Chrome
|
| 49 |
+
RUN wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | gpg --dearmor -o /usr/share/keyrings/google-chrome.gpg \
|
| 50 |
+
&& echo "deb [arch=amd64 signed-by=/usr/share/keyrings/google-chrome.gpg] http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list \
|
| 51 |
+
&& apt-get update \
|
| 52 |
+
&& apt-get install -y google-chrome-stable \
|
| 53 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 54 |
+
|
| 55 |
+
# Copy requirements first (for better caching)
|
| 56 |
+
COPY requirements.txt .
|
| 57 |
+
|
| 58 |
+
# Install Python dependencies
|
| 59 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 60 |
+
|
| 61 |
+
# Copy application code
|
| 62 |
+
COPY . .
|
| 63 |
+
|
| 64 |
+
# Expose port 7860
|
| 65 |
+
EXPOSE 7860
|
| 66 |
+
|
| 67 |
+
# Run the app
|
| 68 |
+
CMD ["python", "app.py"]
|