forked from DevilXD/TwitchDropsMiner
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
68 lines (53 loc) · 1.81 KB
/
Dockerfile
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
# Stage 1: Build
FROM python:3.13-slim-bookworm AS build
# Install system dependencies and build dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends \
libgirepository1.0-dev \
python3-gi \
gobject-introspection \
gir1.2-gtk-3.0 \
gir1.2-ayatanaappindicator3-0.1 \
libcairo2-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Set the working directory
WORKDIR /TwitchDropsMiner/
# Copy only the files needed for pip install first to leverage Docker's cache
COPY requirements.txt ./
# Upgrade pip and install Python dependencies
RUN pip install --upgrade pip && \
pip install --no-cache-dir --progress-bar off -r requirements.txt
# Copy the rest of the application code
COPY . .
# Make the entrypoint script and healthcheck script executable
RUN chmod +x ./docker_entrypoint.sh && \
chmod +x ./healthcheck.sh
# Stage 2: Final
FROM python:3.13-slim-bookworm
# Set the working directory
WORKDIR /TwitchDropsMiner/
# Install system dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends \
nano \
libx11-6 \
tk \
xvfb \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Copy the application and dependencies from the build stage
COPY --from=build /TwitchDropsMiner /TwitchDropsMiner
# Copy only the necessary files to the final image
COPY --from=build /usr/local/lib/python3.13/site-packages /usr/local/lib/python3.13/site-packages
COPY --from=build /usr/local/bin /usr/local/bin
# Environment variables
ENV UNLINKED_CAMPAIGNS=0
ENV PRIORITY_MODE=1
ENV TDM_DOCKER=true
# Set the entrypoint and default command
ENTRYPOINT ["./docker_entrypoint.sh"]
# Healthcheck
HEALTHCHECK --interval=10s --timeout=5s --start-period=1m --retries=3 CMD ["./healthcheck.sh"]
# Default command
CMD ["sh", "-c", "python main.py -vvv"]