From 61ba0dd445b3582ee33cd72ea6e3e1159b8f4e2e Mon Sep 17 00:00:00 2001 From: Sergey Evstegneiev Date: Fri, 5 May 2023 13:50:48 +0200 Subject: [PATCH] preparing to deploy --- .env | 1 - Dockerfile.icecast | 16 ++++++++++++++++ Dockerfile.music.mpd | 18 +++++++++++------- Dockerfile.py.bot | 5 +++++ Dockerfile.voice.mpd | 9 ++++----- bot.env | 2 ++ docker-compose.yml | 24 ++++++++++++++---------- logs/.keep | 0 mpd.voice.conf | 2 +- mpd/playlists/.keep | 0 mpd/run/.keep | 0 11 files changed, 53 insertions(+), 24 deletions(-) delete mode 100644 .env create mode 100644 Dockerfile.icecast create mode 100644 bot.env create mode 100644 logs/.keep create mode 100644 mpd/playlists/.keep create mode 100644 mpd/run/.keep diff --git a/.env b/.env deleted file mode 100644 index ffe34cf..0000000 --- a/.env +++ /dev/null @@ -1 +0,0 @@ -TELEGRAM_BOT_TOKEN=!!!! Get token from @BotFather diff --git a/Dockerfile.icecast b/Dockerfile.icecast new file mode 100644 index 0000000..1642910 --- /dev/null +++ b/Dockerfile.icecast @@ -0,0 +1,16 @@ +FROM alpine:latest + +ARG UID +ARG GID + +RUN addgroup -g ${GID} -S icecast && \ + adduser --uid ${UID} -S icecast icecast + +RUN apk add --update \ + icecast \ + mailcap && \ + rm -rf /var/cache/apk/* + +EXPOSE 8000 +VOLUME ["/var/log/icecast"] +CMD icecast -c /etc/icecast.xml \ No newline at end of file diff --git a/Dockerfile.music.mpd b/Dockerfile.music.mpd index a8a742a..c921c6c 100644 --- a/Dockerfile.music.mpd +++ b/Dockerfile.music.mpd @@ -1,18 +1,22 @@ FROM alpine:latest +ARG UID +ARG GID + +RUN addgroup -g ${GID} -S mpd && adduser --uid ${UID} -S -G mpd mpd + RUN apk update && \ apk add mpd -RUN apk add lsof bash -# COPY mpd.music.conf /etc/mpd.conf -COPY ./jingles/nightingale_singing.mp3 /usr/share/icecast/web/ - -RUN addgroup mpd RUN mkdir -p /music -RUN mkdir -p /mpd +RUN mkdir -p /mpd/db +RUN mkdir -p /mpd/playlists + +RUN chown -R mpd:mpd /mpd +RUN chown -R mpd:mpd /music VOLUME /music VOLUME /mpd -# CMD ["lsof", "-i", ":6600"] +USER mpd CMD ["mpd", "--stderr", "--no-daemon", "/etc/mpd.conf"] diff --git a/Dockerfile.py.bot b/Dockerfile.py.bot index 88980dd..c3da4b9 100644 --- a/Dockerfile.py.bot +++ b/Dockerfile.py.bot @@ -1,5 +1,10 @@ FROM python:3.9-alpine +ARG UID +ARG GID + +RUN addgroup -g ${GID} -S bot && adduser --uid ${UID} -S -G bot bot + WORKDIR /app COPY requirements.txt . diff --git a/Dockerfile.voice.mpd b/Dockerfile.voice.mpd index 5f603b7..3e795d4 100644 --- a/Dockerfile.voice.mpd +++ b/Dockerfile.voice.mpd @@ -1,12 +1,11 @@ FROM alpine:latest +ARG UID +ARG GID +RUN addgroup -g ${GID} -S mpd && adduser --uid ${UID} -S -G mpd mpd + RUN apk update && \ apk add mpd -RUN apk add lsof bash - -RUN addgroup mpd -RUN mkdir -p /voice -RUN mkdir -p /mpd VOLUME /music VOLUME /mpd diff --git a/bot.env b/bot.env new file mode 100644 index 0000000..897eb39 --- /dev/null +++ b/bot.env @@ -0,0 +1,2 @@ +TELEGRAM_BOT_TOKEN="!!! Get token from @BotFather and put it here !!!" + diff --git a/docker-compose.yml b/docker-compose.yml index 08e93eb..8b56d79 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,32 +1,34 @@ -version: '3.8' +version: '3.8' services: icecast: - user: icecast - image: infiniteproject/icecast + user: "${UID}:${GID}" + build: + context: . + dockerfile: Dockerfile.voice.mpd + image: irirangi-icecast-image ports: - "8000:8000" volumes: - ./icecast.xml:/etc/icecast.xml - ./music:/music - ./jingles:/usr/share/icecast/web/jingles - - ./logs/icecast:/var/log/icecast mpd-voice: - user: mpd + user: "${UID}:${GID}" build: context: . dockerfile: Dockerfile.voice.mpd - image: irirangi-mpd-voice-image:latest + image: irirangi-mpd-voice-image volumes: - ./mpd.voice.conf:/etc/mpd.conf - ./voice:/voice - ./mpd:/mpd mpd: - user: mpd + user: "${UID}:${GID}" build: context: . dockerfile: Dockerfile.music.mpd - image: irirangi-mpd-image:latest + image: irirangi-mpd-image volumes: - ./mpd/run/:/run/mpd/ - ./mpd.music.conf:/etc/mpd.conf @@ -34,13 +36,15 @@ services: - ./mpd:/mpd bot: + user: "${UID}:${GID}" build: context: . dockerfile: Dockerfile.py.bot - image: irirangi-telegram-bot:latest + image: irirangi-telegram-bot + env_file: + - bot.env volumes: - ./music:/music - ./voice:/voice - ./app:/app - command: /bin/sh -c "sleep 2 && python /app/bot.py" restart: unless-stopped diff --git a/logs/.keep b/logs/.keep new file mode 100644 index 0000000..e69de29 diff --git a/mpd.voice.conf b/mpd.voice.conf index 8bf412d..c88858d 100644 --- a/mpd.voice.conf +++ b/mpd.voice.conf @@ -37,7 +37,7 @@ audio_output { music_directory "/voice" # Set the playlist directory -playlist_directory "/mpd/playlists.voice" +playlist_directory "/mpd/playlists" # Set the database directory db_file "/mpd/tag_cache.voice" diff --git a/mpd/playlists/.keep b/mpd/playlists/.keep new file mode 100644 index 0000000..e69de29 diff --git a/mpd/run/.keep b/mpd/run/.keep new file mode 100644 index 0000000..e69de29