-
-
Notifications
You must be signed in to change notification settings - Fork 62
/
Dockerfile-release
193 lines (169 loc) · 4.88 KB
/
Dockerfile-release
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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
FROM alpine:3.19 AS build
WORKDIR /tmp/workdir
ENV PREFIX="/tmp/install"
ARG BUILD_PACKAGES=" \
ca-certificates \
curl \
bzip2 \
pkgconfig \
coreutils \
autoconf \
automake \
libtool \
g++ \
make \
openjpeg-dev \
libpng-dev \
nasm \
yasm \
curl \
libogg-dev \
opus-dev \
libvorbis-dev \
lame-dev \
cmake \
zlib-dev \
openssl-dev \
boost-dev \
libarchive-dev \
libconfig-dev \
utfcpp \
sqlite-dev \
gtest-dev"
RUN apk add --no-cache --update ${BUILD_PACKAGES}
# ffmpeg
ARG FFMPEG_VERSION=6.1.1
RUN \
DIR=/tmp/ffmpeg && mkdir -p ${DIR} && cd ${DIR} && \
curl -sLO https://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.bz2 && \
tar -jx --strip-components=1 -f ffmpeg-${FFMPEG_VERSION}.tar.bz2
RUN \
DIR=/tmp/ffmpeg && mkdir -p ${DIR} && cd ${DIR} && \
./configure \
--prefix=${PREFIX} \
--disable-autodetect \
--disable-debug \
--disable-doc \
--disable-ffplay \
--disable-ffprobe \
--disable-openssl \
--disable-postproc \
--disable-pixelutils \
--disable-network \
--enable-shared \
--disable-static \
--enable-gpl \
--enable-small \
--enable-version3 \
--enable-nonfree \
--enable-libmp3lame \
--enable-libopenjpeg \
--enable-libopus \
--enable-libvorbis \
--disable-everything \
--enable-decoder=aac*,ac3*,alac,als,dsd*,flac,mp3*,libopus,pcm*,libvorbis,wavpack,wma*,libopenjpg,png \
--enable-encoder=libmp3lame,libopus,libvorbis \
--enable-demuxer=aac,aiff,asf,dsf,flac,ipod,ogg,matroska,mov,mp3,mp4,wav,wv,webm \
--enable-muxer=ogg,matroska,mp3,webm \
--enable-protocol=file,pipe \
--enable-filter=aresample \
--extra-libs=-ldl && \
make -j$(nproc) && \
make install && \
make distclean
# WT
ARG WT_VERSION=4.10.4
RUN \
DIR=/tmp/wt && mkdir -p ${DIR} && cd ${DIR} && \
curl -sLO https://github.com/emweb/wt/archive/${WT_VERSION}.tar.gz && \
tar -x --strip-components=1 -f ${WT_VERSION}.tar.gz
RUN \
DIR=/tmp/wt && mkdir -p ${DIR} && cd ${DIR} && \
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${PREFIX} -DBUILD_EXAMPLES=OFF -DENABLE_LIBWTTEST=OFF -DCONNECTOR_FCGI=OFF -DUSE_SYSTEM_SQLITE3=ON && \
make -j$(nproc) && \
make install
# STB
ARG STB_VERSION=ae721c50eaf761660b4f90cc590453cdb0c2acd0
RUN \
DIR=/tmp/stb && mkdir -p ${DIR} && cd ${DIR} && \
curl -sLO https://github.com/nothings/stb/archive/${STB_VERSION}.tar.gz && \
tar -x --strip-components=1 -f ${STB_VERSION}.tar.gz && \
mkdir -p ${PREFIX}/include/stb && \
cp ./*.h ${PREFIX}/include/stb
# TAGLIB
ARG TAGLIB_VERSION=v2.0.1
RUN \
DIR=/tmp/taglib && mkdir -p ${DIR} && cd ${DIR} && \
curl -sLO https://github.com/taglib/taglib/archive/${TAGLIB_VERSION}.tar.gz && \
tar -x --strip-components=1 -f ${TAGLIB_VERSION}.tar.gz
RUN \
DIR=/tmp/taglib && mkdir -p ${DIR} && cd ${DIR} && \
CXXFLAGS="-I/usr/include/utf8cpp" cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${PREFIX} -DBUILD_SHARED_LIBS=ON -DBUILD_EXAMPLES=OFF -DBUILD_BINDINGS=OFF -DBUILD_TESTING=OFF -DTRACE_IN_RELEASE=OFF -DWITH_ZLIB=ON && \
make -j$(nproc) && \
make install
# LMS
COPY . /tmp/lms/
RUN \
DIR=/tmp/lms/build && mkdir -p ${DIR} && cd ${DIR} && \
PKG_CONFIG_PATH=/tmp/install/lib/pkgconfig CXXFLAGS="-I${PREFIX}/include" LDFLAGS="-L${PREFIX}/lib -Wl,--rpath-link=${PREFIX}/lib" cmake /tmp/lms/ -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${PREFIX} -DCMAKE_PREFIX_PATH=${PREFIX} && \
LD_LIBRARY_PATH=${PREFIX}/lib make -j$(nproc) && \
LD_LIBRARY_PATH=${PREFIX}/lib make test && \
make install && \
mkdir -p ${PREFIX}/etc/ && \
cp /tmp/lms/conf/lms.conf ${PREFIX}/etc
# Now copy all the stuff installed in a new folder (/tmp/fakeroot/)
RUN \
mkdir -p /tmp/fakeroot/bin && \
for bin in ${PREFIX}/bin/ffmpeg ${PREFIX}/bin/lms*; \
do \
strip --strip-all $bin && \
cp $bin /tmp/fakeroot/bin/; \
done && \
for lib in ${PREFIX}/lib/*.so; \
do \
strip --strip-all $lib; \
done && \
cp -r ${PREFIX}/lib /tmp/fakeroot/lib && \
cp -r ${PREFIX}/share /tmp/fakeroot/share && \
rm -rf /tmp/fakeroot/share/doc && \
rm -rf /tmp/fakeroot/share/man
# Remove useless stuff
RUN \
rm -rf /tmp/fakeroot/share/Wt/resources/jPlayer \
rm -rf /tmp/fakeroot/share/Wt/resources/themes
## Release Stage
FROM alpine:3.19 AS release
LABEL maintainer="Emeric Poupon <[email protected]>"
ARG RUNTIME_PACKAGES=" \
libssl3 \
libcrypto3 \
openjpeg \
libpng \
libogg \
opus \
libvorbis \
lame-libs \
zlib \
boost-filesystem \
boost-iostreams \
boost-program_options \
boost-system \
boost-thread \
libarchive \
libconfig++ \
sqlite-libs"
ARG LMS_USER=lms
ARG LMS_GROUP=lms
RUN apk add --no-cache --update ${RUNTIME_PACKAGES}
RUN addgroup -S ${LMS_GROUP} && \
adduser -S -H ${LMS_USER} && \
adduser ${LMS_USER} ${LMS_GROUP} && \
mkdir -p /var/lms && chown -R ${LMS_USER}:${LMS_GROUP} /var/lms
VOLUME /var/lms
VOLUME /music
VOLUME /usr/local/etc
USER ${LMS_USER}:${LMS_GROUP}
COPY --from=build /tmp/fakeroot/ /usr
COPY --from=build /tmp/fakeroot/share/lms/lms.conf /etc/lms.conf
EXPOSE 5082
ENTRYPOINT ["/usr/bin/lms"]