From 02492d3733049601b870ae733478cbba0b3ae33c Mon Sep 17 00:00:00 2001 From: Glauber Ferreira Date: Thu, 23 May 2024 21:19:51 -0300 Subject: [PATCH] primeiro commit --- Dockerfile | 19 +++++++++++++++++++ haccme.patch | 18 ++++++++++++++++++ run | 8 ++++++++ 3 files changed, 45 insertions(+) create mode 100644 Dockerfile create mode 100644 haccme.patch create mode 100644 run diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..6343454 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +FROM alpine:3.19 as builder +RUN apk add libxslt-dev libxml2-dev libogg-dev libvorbis-dev libtheora-dev openssl-dev curl-dev g++ gcc make git autoconf automake libtool patch +RUN git clone --recursive https://gitlab.xiph.org/xiph/icecast-server.git -b v2.5.0-beta.3 /usr/src/icecast-server +COPY haccme.patch /usr/src/icecast-server/haccme.patch +RUN cd /usr/src/icecast-server &&\ + patch -p1 < /usr/src/icecast-server/haccme.patch &&\ + autoreconf -i &&\ + ./configure --prefix=/opt/icecast-server --with-curl &&\ + make install + +FROM alpine:3.19 +COPY --from=builder /opt/icecast-server /opt/icecast-server +RUN apk add libcurl libogg libssl3 libtheora libvorbis libxml2 libxslt bash +COPY run /usr/local/bin/run +RUN chmod +x /usr/local/bin/run &&\ + mkdir -p /opt/icecast-server/var/log/icecast +VOLUME ["/opt/icecast-server/config"] +VOLUME ["/opt/icecast-server/var/log/icecast"] +ENTRYPOINT ["/usr/local/bin/run"] diff --git a/haccme.patch b/haccme.patch new file mode 100644 index 0000000..b1ae47d --- /dev/null +++ b/haccme.patch @@ -0,0 +1,18 @@ +diff --git a/src/main.c b/src/main.c +index dc66a15f..c7f2eb21 100644 +--- a/src/main.c ++++ b/src/main.c +@@ -663,13 +663,6 @@ int main(int argc, char **argv) + #ifdef HAVE_SETUID + /* We'll only have getuid() if we also have setuid(), it's reasonable to + * assume */ +- if(!getuid() && getpid() != 1) /* Running as root! Don't allow this */ +- { +- fprintf(stderr, "ERROR: You should not run icecast2 as root\n"); +- fprintf(stderr, "Use the changeowner directive in the config file\n"); +- shutdown_subsystems(); +- return 1; +- } + #endif + + /* setup default signal handlers */ diff --git a/run b/run new file mode 100644 index 0000000..ba630ec --- /dev/null +++ b/run @@ -0,0 +1,8 @@ +#!/bin/bash +set -e +configfile=/opt/icecast-server/config/icecast.xml +if [ ! -f "$configfile" ]; then + echo "arquivo $configfile não existe, criando config padrão" + cp -v /opt/icecast-server/etc/icecast.xml "$configfile" +fi +/opt/icecast-server/bin/icecast -c "$configfile"