dndmusicbot/Dockerfile.bot

62 lines
2.0 KiB
Docker

FROM golang:1.21-bookworm as builder
ENV FFMPEG_VERSION=5.1.2
ENV MPD_VERSION=0.23.14
RUN apt-get update && apt-get -y install \
libopus-dev libopusfile-dev \
meson g++ nasm \
libfmt-dev \
libpcre2-dev \
libmad0-dev libmpg123-dev libid3tag0-dev \
libflac-dev libvorbis-dev libopus-dev libogg-dev \
libadplug-dev libaudiofile-dev libsndfile1-dev libfaad-dev \
libsamplerate0-dev libsoxr-dev \
libcurl4-gnutls-dev \
libboost-dev \
zlib1g-dev
WORKDIR /tmp
RUN curl -LOs http://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.xz && tar xvf ffmpeg-${FFMPEG_VERSION}.tar.xz && \
cd ffmpeg-${FFMPEG_VERSION} && \
./configure \
--enable-version3 \
--enable-gpl \
--enable-nonfree \
--enable-small \
--enable-libvorbis \
--enable-libopus \
--enable-postproc \
--enable-openssl \
--disable-debug && \
make && \
make install
RUN curl -LOs https://www.musicpd.org/download/mpd/0.23/mpd-${MPD_VERSION}.tar.xz && tar xvf mpd-${MPD_VERSION}.tar.xz && \
cd mpd-${MPD_VERSION} && \
meson . output/release --buildtype=minsize -Db_ndebug=true && \
ninja -C output/release
WORKDIR /src
COPY . .
RUN go build
FROM debian:bookworm-slim
RUN apt-get update && apt-get -y install \
ca-certificates \
libopus-dev libopusfile-dev \
libfmt-dev \
libpcre2-dev \
libmad0-dev libmpg123-dev libid3tag0-dev \
libflac-dev libvorbis-dev libopus-dev libogg-dev \
libadplug-dev libaudiofile-dev libsndfile1-dev libfaad-dev \
libsamplerate0-dev libsoxr-dev \
libcurl4-gnutls-dev \
curl && \
curl -L https://github.com/badaix/snapcast/releases/download/v0.27.0/snapclient_0.27.0-1_without-pulse_amd64.deb -o /tmp/snapcast.deb && \
curl -L http://ftp.no.debian.org/debian/pool/main/f/flac/libflac8_1.3.3-2+deb11u2_amd64.deb -o /tmp/libflac8.deb && \
apt -y install /tmp/snapcast.deb /tmp/libflac8.deb && rm -rf /tmp/*.deb
COPY --from=builder /src/dndmusicbot /app/
COPY --from=builder /tmp/mpd-0.23.14/output/release/mpd /usr/local/bin
COPY --from=builder /usr/local/bin/ffmpeg /usr/local/bin
COPY mp3 /app/mp3
ADD tmpl /app/tmpl
WORKDIR /app
ENTRYPOINT [ "/app/dndmusicbot" ]