Update Kirika, slim Docker image using a multi-stage build
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
DataHoarder 2022-07-24 22:34:08 +02:00
parent 3ac94dde49
commit de36a21672
Signed by: DataHoarder
SSH key fingerprint: SHA256:OLTRf6Fl87G52SiR7sWLGNzlJt4WOX+tfI2yxo0z7xk
3 changed files with 56 additions and 30 deletions

View file

@ -1,4 +1,4 @@
FROM golang:1.18-alpine
FROM golang:1.18-alpine AS builder
WORKDIR /src
@ -8,70 +8,81 @@ ENV LDFLAGS="-flto"
ENV CGO_CFLAGS="-march=native -Ofast"
RUN apk update && apk add --no-cache \
git gcc g++ bash autoconf automake cmake make libtool gettext \
openssl-dev && \
git clone --depth 1 --branch v1.2.6 https://github.com/jiixyj/libebur128.git && cd libebur128 && \
git gcc g++ musl-dev bash autoconf automake cmake make libtool gettext \
openssl-dev
RUN git clone --depth 1 --branch v1.2.6 https://github.com/jiixyj/libebur128.git && cd libebur128 && \
mkdir build && cd build && \
cmake .. -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON -DCMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX:PATH=/usr && \
make -j$(nproc) && \
make install && \
cd ../.. && \
git clone --depth 1 --branch 0.2.2 https://github.com/libsndfile/libsamplerate.git && cd libsamplerate && \
cd ../..
RUN git clone --depth 1 --branch 0.2.2 https://github.com/libsndfile/libsamplerate.git && cd libsamplerate && \
./autogen.sh && \
./configure --prefix /usr && \
make -j$(nproc) && \
make install && \
cd .. && \
wget https://downloads.sourceforge.net/project/lame/lame/3.100/lame-3.100.tar.gz -O lame-3.100.tar.gz && \
cd ..
RUN wget https://downloads.sourceforge.net/project/lame/lame/3.100/lame-3.100.tar.gz -O lame-3.100.tar.gz && \
tar -xzvf lame-3.100.tar.gz && \
cd lame-3.100 && \
./configure --prefix /usr && \
make -j$(nproc) && \
make install && \
cd .. && \
git clone --depth 1 --branch v1.3.5 https://github.com/xiph/ogg.git && cd ogg && \
cd ..
RUN git clone --depth 1 --branch v1.3.5 https://github.com/xiph/ogg.git && cd ogg && \
./autogen.sh && \
./configure --prefix /usr && \
make -j$(nproc) && \
make install && \
cd .. && \
git clone --branch master https://github.com/xiph/opus.git && cd opus && \
cd ..
RUN git clone --branch master https://github.com/xiph/opus.git && cd opus && \
./autogen.sh && \
./configure --enable-float-approx --prefix /usr && \
make -j$(nproc) && \
make install && \
cd .. && \
git clone --depth 1 --branch v0.12 https://github.com/xiph/opusfile.git && cd opusfile && \
cd ..
RUN git clone --depth 1 --branch v0.12 https://github.com/xiph/opusfile.git && cd opusfile && \
./autogen.sh && \
./configure --prefix /usr && \
make -j$(nproc) && \
make install && \
cd .. && \
git clone --depth 1 --branch master https://github.com/xiph/libopusenc.git && cd libopusenc && \
cd ..
RUN git clone --depth 1 --branch master https://github.com/xiph/libopusenc.git && cd libopusenc && \
./autogen.sh && \
./configure --prefix /usr && \
make -j$(nproc) && \
make install && \
cd .. && \
git clone --depth 1 --branch 1.3.4 https://github.com/xiph/flac.git && cd flac && \
cd ..
RUN git clone --depth 1 --branch 1.3.4 https://github.com/xiph/flac.git && cd flac && \
./autogen.sh && \
./configure --prefix /usr && \
make -j$(nproc) && \
make install && \
cd .. && \
git clone --depth 1 https://github.com/mstorsjo/fdk-aac.git && cd fdk-aac && \
cd ..
RUN git clone --depth 1 https://github.com/mstorsjo/fdk-aac.git && cd fdk-aac && \
./autogen.sh && \
./configure --prefix /usr && \
make -j$(nproc) && \
make install && \
cd .. && \
git clone --depth 1 https://git.gammaspectra.live/S.O.N.G/alac.git && cd alac && \
cd ..
RUN git clone --depth 1 https://git.gammaspectra.live/S.O.N.G/alac.git && cd alac && \
autoreconf -fi && \
./configure --prefix /usr && \
make -j$(nproc) && \
make install && \
cd .. && \
rm -rf /src/libebur128 /src/libsamplerate /src/lame-3.100 /src/ogg /src/opus /src/opusfile /src/flac /src/libopusenc /src/fdk-aac /src/alac
cd ..
RUN rm -rf /src/libebur128 /src/libsamplerate /src/lame-3.100 /src/ogg /src/opus /src/opusfile /src/flac /src/libopusenc /src/fdk-aac /src/alac
COPY . /code
WORKDIR /code
@ -79,5 +90,18 @@ WORKDIR /code
RUN go build -v -o /usr/bin/MeteorLight . && rm -rf /code
FROM alpine:latest
COPY --from=builder /usr/lib/libmp3lame* /usr/lib/
COPY --from=builder /usr/lib/libsamplerate* /usr/lib/
COPY --from=builder /usr/lib/libfdk* /usr/lib/
COPY --from=builder /usr/lib/libFLAC* /usr/lib/
COPY --from=builder /usr/lib/libopus* /usr/lib/
COPY --from=builder /usr/lib/libogg* /usr/lib/
COPY --from=builder /usr/lib/libebur128* /usr/lib/
COPY --from=builder /usr/lib/libalac* /usr/lib/
COPY --from=builder /usr/bin/MeteorLight /usr/bin/MeteorLight
WORKDIR /
ENTRYPOINT ["/usr/bin/MeteorLight"]

4
go.mod
View file

@ -3,8 +3,8 @@ module git.gammaspectra.live/S.O.N.G/MeteorLight
go 1.18
require (
git.gammaspectra.live/S.O.N.G/Kirika v0.0.0-20220721142604-30f5dbab8c59
github.com/BurntSushi/toml v1.1.0
git.gammaspectra.live/S.O.N.G/Kirika v0.0.0-20220722221237-62ee2b9f2b51
github.com/BurntSushi/toml v1.2.0
github.com/dhowden/tag v0.0.0-20220618230019-adf36e896086
github.com/enriquebris/goconcurrentqueue v0.6.3
)

10
go.sum
View file

@ -1,5 +1,7 @@
git.gammaspectra.live/S.O.N.G/Kirika v0.0.0-20220721142604-30f5dbab8c59 h1:lZ4wXJDSCD5+WXw1aa27OtjJKXK26vy82Au5cV2F6Q4=
git.gammaspectra.live/S.O.N.G/Kirika v0.0.0-20220721142604-30f5dbab8c59/go.mod h1:9ROkNM8G6YhteSgDY5cd8vFr69LhFc9n+fZYaM2WBcM=
git.gammaspectra.live/S.O.N.G/Kirika v0.0.0-20220722100701-09f3cf3b563a h1:9CA9ovlLFOFBfRb3zVxcuI7uPfgF0WZpOTOFteHgj0o=
git.gammaspectra.live/S.O.N.G/Kirika v0.0.0-20220722100701-09f3cf3b563a/go.mod h1:9ROkNM8G6YhteSgDY5cd8vFr69LhFc9n+fZYaM2WBcM=
git.gammaspectra.live/S.O.N.G/Kirika v0.0.0-20220722221237-62ee2b9f2b51 h1:C2xFie/tfnqQ2T/Eha7o8rauQjL2m8J2CsV5yfYJU/4=
git.gammaspectra.live/S.O.N.G/Kirika v0.0.0-20220722221237-62ee2b9f2b51/go.mod h1:H+hDdsOEIiRgj8hrR+w91FpqI1AjQTKY0DZosiELA3Y=
git.gammaspectra.live/S.O.N.G/go-alac v0.0.0-20220421115623-d0b3bfe57e0f h1:CxN7zlk5FdAieyRKQSbwBGBsvQ2cDF8JVCODZpzcRkA=
git.gammaspectra.live/S.O.N.G/go-alac v0.0.0-20220421115623-d0b3bfe57e0f/go.mod h1:f1+h7KOnuM9zcEQp7ri4UaVvgX4m1NFFIXgReIyjGMA=
git.gammaspectra.live/S.O.N.G/go-ebur128 v0.0.0-20220720163421-db0c1911921d h1:3M0GZgm2H1tBkDxCwvQdRvnYhF0/velekO9uhVZsbP0=
@ -12,8 +14,8 @@ git.gammaspectra.live/S.O.N.G/go-tta v0.2.1-0.20220226150007-096de1072bd6 h1:ITV
git.gammaspectra.live/S.O.N.G/go-tta v0.2.1-0.20220226150007-096de1072bd6/go.mod h1:cobkT8u8vq/+ngLy+feKS2M2ZT2HoCec5riA/0Cex3Q=
git.gammaspectra.live/S.O.N.G/goflac v0.0.0-20220515172202-6e490998d2a0 h1:imcnwHUqaAJzws41B8sCSp/sUmVranNjAX205Jr4Jc0=
git.gammaspectra.live/S.O.N.G/goflac v0.0.0-20220515172202-6e490998d2a0/go.mod h1:/po1QgOh3xynbvi4sxdY6Iw8m5WPJfGGmry2boZD8fs=
github.com/BurntSushi/toml v1.1.0 h1:ksErzDEI1khOiGPgpwuI7x2ebx/uXQNw7xJpn9Eq1+I=
github.com/BurntSushi/toml v1.1.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
github.com/BurntSushi/toml v1.2.0 h1:Rt8g24XnyGTyglgET/PRUNlrUeu9F5L+7FilkXfZgs0=
github.com/BurntSushi/toml v1.2.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
github.com/aam335/aac-go v0.0.0-20200408070016-52c23bd38988 h1:DZeJTINv0mpfBVfDtQz9vWOn/Uwj3IiA9uP5UJnClZE=
github.com/aam335/aac-go v0.0.0-20200408070016-52c23bd38988/go.mod h1:JBA06GZmW2MVVBYRrKuaZ2AFMSDiPmafb/qmF/ATTUM=
github.com/cocoonlife/testify v0.0.0-20160218172820-792cc1faeb64 h1:LjPYdzoFSAJ5Tr/ElL8kzTJghXgpnOjJVbgd1UvZB1o=