Open jtabet opened 1 year ago
Cool. Just a few thoughts from me.
Here's an untested Dockerfile that I whipped up. It builds both backends but I haven't confirmed if I can render anything.
ARG AUDIO_BACKEND="alsa"
# Build image
FROM alpine:latest AS build
ARG UUID
RUN apk add --update build-base autoconf automake libtool pkgconfig gstreamer-dev libupnp-dev uuidgen
WORKDIR /opt/gmrender-resurrect
COPY . .
RUN ./autogen.sh && ./configure CPPFLAGS="-DGMRENDER_UUID='\"${UUID:-`uuidgen`}\"'"
RUN make && make install DESTDIR=/gmrender-install
# ALSA image
FROM alpine:latest AS alpine-alsa
RUN apk add --update alsa-lib alsa-utils
# PulsaAudio image
FROM alpine:latest AS alpine-pulse
RUN apk add --update pulseaudio
# Run image
FROM alpine-${AUDIO_BACKEND}
COPY --from=build /gmrender-install /
RUN apk add --update tini libupnp gstreamer gstreamer-tools gst-plugins-base gst-plugins-good gst-plugins-bad gst-plugins-ugly
ENV FRIENDLY_NAME=
ENV UUID=
ENV OPTIONS=
EXPOSE 49494
ENTRYPOINT ["/sbin/tini", "--"]
CMD ["/bin/sh", "-c", "/usr/local/bin/gmediarender --logfile=stdout ${FRIENDLY_NAME:+-f \"$FRIENDLY_NAME\"} ${UUID:+--uuid \"$UUID\"} $OPTIONS"]
It defaults to an ALSA backend but PulseAudio can be build with:
docker build -t gmrender_pulse:latest . --build-arg AUDIO_BACKEND=pulse
Here's a comparison of image size
gmrender_debian latest 7dc5e33f3a94 19 seconds ago 791MB
gmrender-alsa latest 27c29f38b254 3 minutes ago 160MB
gmrender-pulse latest 2d4c4b6b8525 4 minutes ago 161MB
I confirm it builds and runs with your changes. However, I cannot provide in depth tests, since I stopped using gmrender-resurrect because I can't use UPnP in my project.
I've confirmed the ALSA backend works on a Raspberry Pi 3 with the following Docker Compose.
services:
gmrender:
image: gmrender:latest
container_name: gmrender-resurrect
restart: unless-stopped
network_mode: host
environment:
OPTIONS: "--mime-filter audio"
devices:
- "/dev/snd:/dev/snd"
This pull requests adds a way to easily integrate gmrender-resurrect in a docker environment. The "FRIENDLY_NAME" environment variable must be provided, and additional volume mounts for pulseaudio.
Here is what's needed to use pulseaudio in docker-compose: