-
Notifications
You must be signed in to change notification settings - Fork 25
/
Dockerfile
74 lines (57 loc) · 2.62 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
69
70
71
72
73
74
ARG TWITCHDOWNLOADER_VERSION="1.55.0"
# Build stage
FROM golang:1.22-bookworm AS build
WORKDIR /app
COPY . .
RUN make build_server build_worker
# Tools stage
FROM debian:bookworm-slim AS tools
WORKDIR /tmp
RUN apt-get update && apt-get install -y --no-install-recommends \
unzip git ca-certificates curl \
&& rm -rf /var/lib/apt/lists/*
# Download TwitchDownloader for the correct platform
ARG TWITCHDOWNLOADER_VERSION
ENV TWITCHDOWNLOADER_URL=https://github.com/lay295/TwitchDownloader/releases/download/${TWITCHDOWNLOADER_VERSION}/TwitchDownloaderCLI-${TWITCHDOWNLOADER_VERSION}-Linux-x64.zip
RUN if [ "$(uname -m)" = "aarch64" ]; then \
TWITCHDOWNLOADER_URL=https://github.com/lay295/TwitchDownloader/releases/download/${TWITCHDOWNLOADER_VERSION}/TwitchDownloaderCLI-${TWITCHDOWNLOADER_VERSION}-LinuxArm64.zip; \
fi && \
echo "Download URL: $TWITCHDOWNLOADER_URL" && \
curl -L $TWITCHDOWNLOADER_URL -o twitchdownloader.zip && \
unzip twitchdownloader.zip && \
rm twitchdownloader.zip
RUN git clone --depth 1 https://github.com/xenova/chat-downloader.git
# Production stage
FROM debian:bookworm-slim
WORKDIR /opt/app
# Install dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
python3 python3-pip fontconfig ffmpeg tzdata procps \
fonts-noto-core fonts-noto-cjk fonts-noto-extra fonts-inter \
curl \
&& rm -rf /var/lib/apt/lists/* \
&& ln -sf python3 /usr/bin/python
# Install pip packages
RUN pip3 install --no-cache-dir --upgrade pip streamlink --break-system-packages
# Install gosu
RUN curl -LO https://github.com/tianon/gosu/releases/latest/download/gosu-$(dpkg --print-architecture | awk -F- '{ print $NF }') \
&& chmod 0755 gosu-$(dpkg --print-architecture | awk -F- '{ print $NF }') \
&& mv gosu-$(dpkg --print-architecture | awk -F- '{ print $NF }') /usr/local/bin/gosu
# Setup user
RUN useradd -u 911 -d /data abc && usermod -a -G users abc
# Copy and install chat-downloader
COPY --from=tools /tmp/chat-downloader /tmp/chat-downloader
RUN cd /tmp/chat-downloader && python3 setup.py install && cd .. && rm -rf chat-downloader
# Setup fonts
RUN chmod 644 /usr/share/fonts/* && chmod -R a+rX /usr/share/fonts
# Copy TwitchDownloaderCLI
COPY --from=tools /tmp/TwitchDownloaderCLI /usr/local/bin/
RUN chmod +x /usr/local/bin/TwitchDownloaderCLI
# Copy application files
COPY --from=build /app/ganymede-api .
COPY --from=build /app/ganymede-worker .
# Setup entrypoint
COPY entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/entrypoint.sh
EXPOSE 4000
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]