-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
executable file
·171 lines (170 loc) · 6.17 KB
/
Dockerfile
File metadata and controls
executable file
·171 lines (170 loc) · 6.17 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
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
168
169
170
171
ARG ALPINE_VER=3.16
# epgdump
FROM alpine:$ALPINE_VER as epgdump
COPY ./epgdump /tmp/epgdump
WORKDIR /tmp
RUN apk --update add gcc g++ make && \
cd /tmp/epgdump && \
make && \
make install
# tspacketchk
FROM alpine:$ALPINE_VER as tspacketchk
WORKDIR /tmp
COPY ./tspacketchk /tmp/tspacketchk
RUN apk --update add git gcc g++ make && \
cd /tmp && \
cd tspacketchk && \
make && \
make install
# tsreadex
FROM alpine:$ALPINE_VER as tsreadex
WORKDIR /tmp
COPY ./tsreadex /tmp/tsreadex
RUN apk add git gcc g++ make cmake linux-headers && \
cd /tmp && \
cd tsreadex && \
cmake . && \
make
# ffmpeg
FROM alpine:$ALPINE_VER as ffmpeg
###############################
# Build the FFmpeg-build image.
ARG PREFIX=/usr/local
ARG LD_LIBRARY_PATH=/usr/local/lib
ARG MAKEFLAGS="-j4"
ENV LD_PRELOAD /usr/bin/lib/preloadable_libiconv.so
# FFmpeg build dependencies.
RUN apk add --update --no-cache --virtual=dev \
autoconf \
automake \
build-base \
curl \
fontconfig-dev \
freetype-dev \
fribidi-dev \
gcc \
git \
libtool \
libva-dev \
openssl-dev \
opus-dev \
pkgconf \
pkgconfig \
wget \
x264-dev \
x265-dev \
yasm && \
# Get AribB24
mkdir -p /tmp/aribb24 && \
cd /tmp/aribb24 && \
curl -fsSL https://github.com/nkoriyama/aribb24/tarball/master | tar -xz --strip-components=1 && \
autoreconf -fiv && \
./configure --prefix=/usr/local --enable-static --disable-shared && \
make && \
make install && \
# fdk-aac https://github.com/mstorsjo/fdk-aac
cd /tmp && \
DIR=$(mktemp -d) && cd ${DIR} && \
curl -sL https://github.com/mstorsjo/fdk-aac/tarball/master | \
tar -zx --strip-components=1 && \
autoreconf -fiv && \
./configure --prefix=/usr/local --disable-static --datadir="${DIR}" && \
make && \
make install && \
# Get ffmpeg source.
cd /tmp/ && \
# git clone https://github.com/0p1pp1/FFmpeg.git ffmpeg && \
git clone https://git.ffmpeg.org/ffmpeg.git && \
cd /tmp/ffmpeg && \
git checkout release/6.1 && \
# Compile ffmpeg.
./configure \
--extra-version=epgradiko0.1 \
--enable-version3 \
--enable-gpl \
--enable-nonfree \
--enable-small \
--enable-libaribb24 \
--enable-libx264 \
--enable-libx265 \
--enable-fontconfig \
--enable-libfreetype \
--enable-libfdk-aac \
--enable-openssl \
--enable-decoder=aac \
--enable-parser=aac \
--enable-muxer=adts \
--disable-debug \
--disable-doc \
--disable-ffplay \
--extra-cflags="-I${PREFIX}/include" \
--extra-ldflags="-L${PREFIX}/lib" \
--extra-libs="-lpthread -lm" \
--prefix="${PREFIX}" && \
make && make install && make distclean
# ベースイメージを定義
FROM alpine:$ALPINE_VER
# Primery packages
ENV TZ=Asia/Tokyo
RUN apk add --update --no-cache tzdata coreutils procps busybox-suid sudo bash && \
cp /usr/share/zoneinfo/Asia/Tokyo /etc/localtime && \
echo "Asia/Tokyo" > /etc/timezone
COPY --from=ffmpeg /usr/local /usr/local
RUN apk add --update --no-cache pcre \
fontconfig \
freetype \
fribidi \
libogg \
libva \
mesa-va-gallium \
openssl \
opus \
x264-libs \
x265-libs && \
ln -s /usr/local/bin/ffmpeg /usr/bin/
COPY --from=epgdump /usr/local /usr/local
COPY --from=tspacketchk /usr/local /usr/local
COPY --from=tsreadex /tmp/tsreadex/tsreadex /usr/local/bin/
COPY ./root_fs /
COPY ./epgradiko /var/www/localhost/
# php8 packages
RUN apk add --update --no-cache s6-overlay apache2 at curl libxml2-utils \
php8 php8-ctype php8-mysqli php8-apache2 php8-mbstring php8-simplexml php8-fileinfo \
php8-posix php8-shmop php8-sysvsem php8-sysvshm php8-pcntl php8-curl php8-iconv \
ca-certificates curl libstdc++ jq && \
rm -rf /var/cache/apk/* && \
addgroup -g 1000 -S epgradiko && \
adduser -u 1000 -S epgradiko -G epgradiko && \
sed -i -e "s/;date.timezone *=.*$/date.timezone = Asia\/Tokyo/" /etc/php8/php.ini && \
sed -i -e "s/memory_limit = 128M/memory_limit = 256M/" /etc/php8/php.ini && \
echo epgradiko >> /etc/at.allow && \
rm -fr /tmp/* && \
sed -i -e "s/User .*$/User epgradiko/" /etc/apache2/httpd.conf && \
sed -i -e "s/Group .*$/Group epgradiko/" /etc/apache2/httpd.conf && \
sed -i -e "s/#ServerName .*$/ServerName epgradiko/" /etc/apache2/httpd.conf && \
# for reverse proxy
sed -i -e "/DocumentRoot /a RemoteIPHeader X-Forwarded-For" /etc/apache2/httpd.conf && \
sed -i -e "/RemoteIPHeader /a SetEnvIf X-Forwarded-User \(\.\*\) REMOTE_USER=\$1" /etc/apache2/httpd.conf && \
sed -i -e "s/\%h/\%a/g" /etc/apache2/httpd.conf && \
sed -i -e "s/#LoadModule remoteip_module modules\/mod_remoteip.so/LoadModule remoteip_module modules\/mod_remoteip.so/" /etc/apache2/httpd.conf && \
# for api.php
sed -i -e "s/#LoadModule rewrite_module modules\/mod_rewrite.so/LoadModule rewrite_module modules\/mod_rewrite.so/" /etc/apache2/httpd.conf && \
sed -i -e "260,280s/AllowOverride None/AllowOverride All/" /etc/apache2/httpd.conf && \
# for noisy log
sed -i -e "/SetEnvIf X-Forwarded-User /a SetEnvIf Request_URI \"sub\/get_file\.php$\" nolog" /etc/apache2/httpd.conf && \
sed -i -e "s/ CustomLog logs\/access\.log combined/ CustomLog logs\/access.log combined env=!nolog/" /etc/apache2/httpd.conf && \
# for ts mime
sed -i -e "s/# video\/mp2t.*$/video\/mp2t\t\t\t\t\tts/" /etc/apache2/mime.types && \
ln -sf /usr/bin/php8 /usr/bin/php && \
# http-dir
rm -f /var/www/localhost/htdocs/index.html && \
rm -fr /var/www/localhost/cgi-bin && \
chown -R 1000:1000 /var/www/localhost/ && \
ln -sf /dev/stdout /var/log/apache2/access.log && \
ln -sf /dev/stderr /var/log/apache2/error.log && \
chmod -R +x /etc/cont-init.d && \
chmod -R +x /etc/services.d
VOLUME ["/var/spool/atd", "/etc/crontabs"]
VOLUME ["/var/www/localhost/settings", "/var/www/localhost/thumbs", "/var/www/localhost/recorded", "/var/www/localhost/plogs"]
ENTRYPOINT ["/init"]
EXPOSE 80