-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
49 lines (39 loc) · 1.59 KB
/
Dockerfile
File metadata and controls
49 lines (39 loc) · 1.59 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
FROM python:3.10-slim
WORKDIR /app
# Install Chrome
RUN apt-get update && apt-get install -y \
wget \
gnupg \
unzip \
xvfb \
&& wget -q -O - https://dl-ssl.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.list \
&& apt-get update \
&& apt-get install -y google-chrome-stable \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Install ChromeDriver
RUN CHROME_VERSION=$(google-chrome --version | awk '{print $3}' | cut -d. -f1) \
&& CHROMEDRIVER_VERSION=$(curl -s "https://chromedriver.storage.googleapis.com/LATEST_RELEASE_${CHROME_VERSION}") \
&& wget -q "https://chromedriver.storage.googleapis.com/${CHROMEDRIVER_VERSION}/chromedriver_linux64.zip" \
&& unzip chromedriver_linux64.zip \
&& mv chromedriver /usr/bin/chromedriver \
&& chmod +x /usr/bin/chromedriver \
&& rm chromedriver_linux64.zip
# Install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy application files
COPY delete_tweets.py config.example.py ./
COPY README.md LICENSE ./
# Create a sample config file (will be overridden by volume mount)
RUN cp config.example.py config.py
# Define volume for configuration
VOLUME /app/config
# Set environment variables
ENV PYTHONUNBUFFERED=1
ENV DISPLAY=:99
# Create an entrypoint script
RUN echo '#!/bin/bash\nXvfb :99 -screen 0 1920x1080x24 &\npython delete_tweets.py "$@"' > /app/entrypoint.sh \
&& chmod +x /app/entrypoint.sh
ENTRYPOINT ["/app/entrypoint.sh"]