forked from MrBrax/LiveStreamDVR
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
167 lines (139 loc) · 5.44 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
# syntax=docker/dockerfile:1.4
FROM node:22-bookworm-slim
# make app folder
RUN mkdir -p /usr/local/share/twitchautomator \
&& chown -R node:node /usr/local/share/twitchautomator \
&& chmod -R 775 /usr/local/share/twitchautomator
# internal docker build args for build date and dev mode
ARG IS_DEV
ARG BUILD_DATE
ENV IS_DEV=${IS_DEV}
ENV VITE_IS_DEV=${IS_DEV}
ENV BUILD_DATE=${BUILD_DATE}
ENV VITE_BUILD_DATE=${BUILD_DATE}
# system packages
#RUN apk --no-cache add \
# gcc g++ libc-dev git curl \
# ca-certificates \
# python3 py3-pip py3-wheel \
# ffmpeg mediainfo \
# util-linux busybox-initscripts procps gcompat \
# libxml2-dev libxslt-dev python3-dev \
# bash icu-libs krb5-libs libgcc libintl libssl1.1 libstdc++ zlib fontconfig
RUN apt-get update && apt-get install -y \
ffmpeg mediainfo \
python3 python3-pip python3-wheel libxml2-dev libxslt-dev python3-dev \
bash git curl unzip rclone \
&& apt-get clean
# copy over pipenv files and install dependencies for python
# WORKDIR /usr/local/share/twitchautomator
COPY ./Pipfile ./Pipfile.lock ./requirements.txt ./binaries.txt /usr/local/share/twitchautomator/
# install pipenv globally
RUN pip install pipenv && pip cache purge
# switch to node user to install pipenv dependencies
USER node
ENV PATH="${PATH}:/home/node/.local/bin"
RUN cd /usr/local/share/twitchautomator && \
pipenv install --deploy --ignore-pipfile --verbose && \
pipenv --version && \
pipenv run python --version && \
pipenv run streamlink --version
USER root
# remove dev packages
RUN apt-get remove -y \
libxml2-dev libxslt-dev python3-dev \
&& apt-get autoremove -y
# install yarn
# RUN npm install -g yarn
# libfontconfig1 can't be found
# pip packages
# COPY ./requirements.txt /tmp/requirements.txt
# RUN pip install -r /tmp/requirements.txt \
# && rm /tmp/requirements.txt \
# && pip cache purge
# common
COPY --chown=node:node --chmod=775 ./common /usr/local/share/twitchautomator/common
# chat dumper
COPY --chown=node:node --chmod=775 ./twitch-chat-dumper /usr/local/share/twitchautomator/twitch-chat-dumper
RUN cd /usr/local/share/twitchautomator/twitch-chat-dumper \
&& yarn \
&& yarn build \
&& rm -rf node_modules \
&& rm -rf .yarn/cache \
&& yarn cache clean --all
# vod player
COPY --chown=node:node --chmod=775 ./twitch-vod-chat /usr/local/share/twitchautomator/twitch-vod-chat
RUN cd /usr/local/share/twitchautomator/twitch-vod-chat \
&& yarn install --immutable \
&& yarn build --base=/vodplayer \
&& yarn buildlib \
&& rm -rf node_modules \
&& rm -rf .yarn/cache \
&& yarn cache clean --all
# server
COPY --chown=node:node --chmod=775 ./server /usr/local/share/twitchautomator/server
RUN cd /usr/local/share/twitchautomator/server \
&& yarn \
&& yarn lint:ts \
&& yarn build \
&& yarn run generate-licenses \
&& rm -rf node_modules \
&& rm -rf .yarn/cache \
&& yarn cache clean --all
# client
COPY --chown=node:node --chmod=775 ./client-vue /usr/local/share/twitchautomator/client-vue
RUN cd /usr/local/share/twitchautomator/client-vue \
&& yarn \
&& yarn build \
&& yarn run generate-licenses \
&& rm -rf node_modules \
&& rm -rf .yarn/cache \
&& yarn cache clean --all
# copy rest
# COPY --chown=node:node --chmod=775 . /usr/local/share/twitchautomator/
# install dotnet for twitchdownloader
# ADD https://dot.net/v1/dotnet-install.sh /tmp/dotnet-install.sh
# RUN chmod +x /tmp/dotnet-install.sh && /tmp/dotnet-install.sh --channel 3.1 --verbose --install-dir /usr/share/dotnet
# --runtime dotnet
# download twitchdownloader, is this legal? lmao
COPY ./docker/fetch-tdl.sh /tmp/fetch-tdl.sh
RUN bash /tmp/fetch-tdl.sh
ENV TCD_TWITCHDOWNLOADER_PATH=/usr/local/bin/TwitchDownloaderCLI
# make sure plugin path is set with correct permissions
ENV STREAMLINK_PLUGIN_PATH=/usr/local/share/twitchautomator/data/streamlink_plugins
RUN mkdir -p /usr/local/share/twitchautomator/data/streamlink_plugins \
&& chown -R node:node /usr/local/share/twitchautomator/data/streamlink_plugins \
&& chmod -R 775 /usr/local/share/twitchautomator/data/streamlink_plugins
# download ttv-lol-plugin
COPY ./docker/fetch-ttv-lol.sh /tmp/fetch-ttv-lol.sh
RUN bash /tmp/fetch-ttv-lol.sh
# application folder permissions
# seems like docker does not support recursive chown in the copy command
# so this is a workaround, doubling the layer size unfortunately.
# it also takes a very long time on slow storage
# RUN chown -c -R node:node /usr/local/share/twitchautomator && chmod -R 775 /usr/local/share/twitchautomator
# RUN chown -c -R node:node /usr/local/share/twitchautomator/data && chmod -R 775 /usr/local/share/twitchautomator/data
# make home folder
RUN mkdir -p /home/node && chown -R node:node /home/node
ENV HOME /home/node
# fonts
RUN mkdir /home/node/.fonts && chown node:node /home/node/.fonts
COPY ./docker/fonts /home/node/.fonts
# get certs
# RUN wget https://curl.haxx.se/ca/cacert.pem -O /tmp/cacert.pem
# twitchautomator docker specific configs
ENV TCD_BIN_DIR=/usr/local/bin
ENV TCD_FFMPEG_PATH=/usr/bin/ffmpeg
ENV TCD_BIN_PATH_PYTHON=/usr/bin/python
ENV TCD_BIN_PATH_PYTHON3=/usr/bin/python3
ENV TCD_MEDIAINFO_PATH=/usr/bin/mediainfo
ENV TCD_NODE_PATH=/usr/local/bin/node
ENV TCD_DOCKER=1
ENV TCD_WEBSOCKET_ENABLED=1
# ENV TCD_CA_PATH=/tmp/cacert.pem
ENV TCD_SERVER_PORT=8080
ENV TCD_PYTHON_ENABLE_PIPENV=1
# USER node
WORKDIR /usr/local/share/twitchautomator/server
ENTRYPOINT [ "yarn", "run", "start" ]
EXPOSE 8080