simoncck commited on
Commit
15d9c52
·
verified ·
1 Parent(s): 4e5febb

Create dockerfile

Browse files
Files changed (1) hide show
  1. dockerfile +68 -0
dockerfile ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use Python 3.11 slim as base image
2
+ FROM python:3.11-slim
3
+
4
+ # Set environment variables
5
+ ENV PYTHONDONTWRITEBYTECODE=1
6
+ ENV PYTHONUNBUFFERED=1
7
+ ENV DEBIAN_FRONTEND=noninteractive
8
+
9
+ # Set work directory
10
+ WORKDIR /app
11
+
12
+ # Install system dependencies
13
+ RUN apt-get update && apt-get install -y \
14
+ wget \
15
+ gnupg \
16
+ unzip \
17
+ curl \
18
+ xvfb \
19
+ x11vnc \
20
+ fluxbox \
21
+ wmctrl \
22
+ dbus-x11 \
23
+ && rm -rf /var/lib/apt/lists/*
24
+
25
+ # Add Google Chrome repository and install Chrome
26
+ RUN wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | apt-key add - \
27
+ && echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list \
28
+ && apt-get update \
29
+ && apt-get install -y google-chrome-stable \
30
+ && rm -rf /var/lib/apt/lists/*
31
+
32
+ # Install ChromeDriver
33
+ RUN CHROME_VERSION=$(google-chrome --version | cut -d " " -f3 | cut -d "." -f1) \
34
+ && CHROMEDRIVER_VERSION=$(curl -s "https://chromedriver.storage.googleapis.com/LATEST_RELEASE_${CHROME_VERSION}") \
35
+ && wget -O /tmp/chromedriver.zip "https://chromedriver.storage.googleapis.com/${CHROMEDRIVER_VERSION}/chromedriver_linux64.zip" \
36
+ && unzip /tmp/chromedriver.zip -d /tmp/ \
37
+ && mv /tmp/chromedriver /usr/local/bin/chromedriver \
38
+ && chmod +x /usr/local/bin/chromedriver \
39
+ && rm /tmp/chromedriver.zip
40
+
41
+ # Copy requirements file
42
+ COPY requirements.txt .
43
+
44
+ # Install Python dependencies
45
+ RUN pip install --no-cache-dir -r requirements.txt
46
+
47
+ # Install Playwright browsers
48
+ RUN playwright install chromium
49
+ RUN playwright install-deps
50
+
51
+ # Copy application code
52
+ COPY . .
53
+
54
+ # Create directories for screenshots and logs
55
+ RUN mkdir -p /app/screenshots /app/logs
56
+
57
+ # Set proper permissions
58
+ RUN chmod -R 755 /app
59
+
60
+ # Expose port
61
+ EXPOSE 7860
62
+
63
+ # Health check
64
+ HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
65
+ CMD curl -f http://localhost:7860/health || exit 1
66
+
67
+ # Start command
68
+ CMD ["python", "app.py"]