primeiro commit

This commit is contained in:
alphard 2024-05-23 21:19:51 -03:00
commit 02492d3733
3 changed files with 45 additions and 0 deletions

19
Dockerfile Normal file
View File

@ -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"]

18
haccme.patch Normal file
View File

@ -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 */

8
run Normal file
View File

@ -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"