-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
68 lines (58 loc) · 1.92 KB
/
Dockerfile
File metadata and controls
68 lines (58 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
FROM python:3.9-slim
# Install system dependencies
RUN apt-get update && apt-get install -y \
wget \
gnupg \
unzip \
curl \
xvfb \
libxi6 \
libgconf-2-4 \
libnss3 \
libxss1 \
libglib2.0-0 \
libxft2 \
libfreetype6 \
libfontconfig1 \
libxrender1 \
libasound2 \
libxtst6 \
libxrandr2 \
libasound2 \
libpangocairo-1.0-0 \
libatk1.0-0 \
libcairo-gobject2 \
libgtk-3-0 \
libgdk-pixbuf2.0-0 \
&& rm -rf /var/lib/apt/lists/*
# Install Google Chrome
RUN wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list \
&& apt-get update \
&& apt-get install -y google-chrome-stable \
&& rm -rf /var/lib/apt/lists/*
# Install ChromeDriver - using a stable version that works with current Chrome
RUN CHROMEDRIVER_VERSION="130.0.6723.91" \
&& echo "Installing ChromeDriver version: $CHROMEDRIVER_VERSION" \
&& wget -O /tmp/chromedriver.zip "https://storage.googleapis.com/chrome-for-testing-public/$CHROMEDRIVER_VERSION/linux64/chromedriver-linux64.zip" \
&& unzip /tmp/chromedriver.zip -d /tmp/ \
&& mv /tmp/chromedriver-linux64/chromedriver /usr/local/bin/ \
&& rm -rf /tmp/chromedriver* \
&& chmod +x /usr/local/bin/chromedriver \
&& echo "ChromeDriver installed successfully"
# Set working directory
WORKDIR /app
# Copy requirements first for better caching
COPY requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Copy application code
COPY . .
# Create non-root user for security
RUN useradd --create-home --shell /bin/bash app \
&& chown -R app:app /app
USER app
# Expose port
EXPOSE 5000
# Run the application
CMD ["gunicorn", "--bind", "0.0.0.0:5000", "--workers", "1", "--threads", "4", "--timeout", "120", "app:app"]