diff --git a/icecast2/Dockerfile b/icecast2/Dockerfile new file mode 100644 index 0000000..2474b0e --- /dev/null +++ b/icecast2/Dockerfile @@ -0,0 +1,19 @@ +FROM debian:latest as builder + +WORKDIR /app + + +RUN apt-get update \ + && apt-get install --yes icecast2 gettext media-types +# RUN apt-get install --yes liquidsoap + +RUN useradd radio +RUN chown -R radio:radio /etc/icecast2 /var/log/icecast2 +# RUN chown -R radio:radio /etc/liquidsoap /var/log/liquidsoap +USER radio + +COPY icecast.xml.template /etc/icecast2/icecast.xml.template +# COPY stream.liq.template /etc/liquidsoap/stream.liq.template +COPY entrypoint.sh /entrypoint.sh + +ENTRYPOINT [ "/entrypoint.sh" ] diff --git a/icecast2/entrypoint.sh b/icecast2/entrypoint.sh new file mode 100755 index 0000000..19510bc --- /dev/null +++ b/icecast2/entrypoint.sh @@ -0,0 +1,11 @@ +#!/bin/sh +set -e + +# Substitute environment variables into template +envsubst < /etc/icecast2/icecast.xml.template > /etc/icecast2/icecast.xml +# envsubst < /etc/liquidsoap/stream.liq.template > /etc/liquidsoap/stream.liq + +# Run icecast with the generated config +exec icecast2 -c /etc/icecast2/icecast.xml +# exec liquidsoap /etc/liquidsoap/stream.liq +# wait -n diff --git a/icecast2/icecast.xml.template b/icecast2/icecast.xml.template new file mode 100644 index 0000000..6930409 --- /dev/null +++ b/icecast2/icecast.xml.template @@ -0,0 +1,37 @@ + + + ${ICECAST_SOURCE_PASSWORD} + ${ICECAST_RELAY_PASSWORD} + ${ICECAST_ADMIN_USER} + ${ICECAST_ADMIN_PASSWORD} + + + ${ICECAST_HOST} + London, UK + adam.a.french@outlook.com + + + ${ICECAST_PORT} + + + + ${ICECAST_MOUNT} + + + + 100 + 2 + + + + /usr/share/icecast2 + /var/log/icecast2 + /usr/share/icecast2/web + /usr/share/icecast2/admin + + + + + 0 + + diff --git a/icecast2/stream.liq.template b/icecast2/stream.liq.template new file mode 100644 index 0000000..91c8d57 --- /dev/null +++ b/icecast2/stream.liq.template @@ -0,0 +1,13 @@ +# Microphone input +mic = input.pulseaudio() + +# Icecast output +output.icecast( + %mp3, + host = "$ICECAST_HOST", + port = "$ICECAST_PORT", + password = "$ICECAST_SOURCE_PASSWORD", + mount = "$ICECAST_MOUNT", + name = "Live DJ stream", + mic +)