diff --git a/docker-compose.yml b/docker-compose.yml index d20a97e..d970add 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,10 +8,7 @@ services: context: ./nginx dockerfile: Dockerfile container_name: nginx - environment: - BACKEND_HOST: "${BACKEND_HOST}" # from .env - BACKEND_PORT: "${BACKEND_PORT}" # from .env - DOMAIN: "${DOMAIN}" # from .env + env_file: ./.env restart: unless-stopped depends_on: - backend @@ -62,18 +59,16 @@ services: image: postgres:16 container_name: "${POSTGRES_HOST}" restart: unless-stopped - environment: - POSTGRES_USER: "${POSTGRES_USER}" - POSTGRES_PASSWORD: "${POSTGRES_PASSWORD}" - POSTGRES_DB: "${POSTGRES_DB}" + env_file: + - ./.env networks: - app-network icecast2: - image: pltnk/icecast2 - container_name: icecast2 + build: + context: ./icecast + dockerfile: Dockerfile + container_name: "${ICECAST_HOST}" restart: always - volumes: - - ./icecast/icecast.xml:/etc/icecast2/icecast.xml env_file: - ./.env diff --git a/icecast/Dockerfile b/icecast/Dockerfile new file mode 100644 index 0000000..c7ed981 --- /dev/null +++ b/icecast/Dockerfile @@ -0,0 +1,10 @@ +FROM pltnk/icecast2 + +# Copy template + entrypoint into image +COPY icecast.xml.template /etc/icecast2/icecast.xml.template +COPY entrypoint.sh /entrypoint.sh + +# Ensure script is executable +RUN chmod +x /entrypoint.sh + +ENTRYPOINT [ "entrypoint.sh" ] diff --git a/icecast/entrypoint.sh b/icecast/entrypoint.sh new file mode 100644 index 0000000..a18194b --- /dev/null +++ b/icecast/entrypoint.sh @@ -0,0 +1,8 @@ +#!/bin/sh +set -e + +# Substitute environment variables into template +envsubst < /etc/icecast2/icecast.xml.template > /etc/icecast2/icecast.xml + +# Run icecast with the generated config +exec icecast -c /etc/icecast2/icecast.xml diff --git a/icecast/icecast.xml b/icecast/icecast.xml deleted file mode 100644 index e69de29..0000000 diff --git a/icecast/icecast.xml.template b/icecast/icecast.xml.template new file mode 100644 index 0000000..8091b93 --- /dev/null +++ b/icecast/icecast.xml.template @@ -0,0 +1,27 @@ + + + ${ICECAST_SOURCE_PASSWORD} + ${ICECAST_RELAY_PASSWORD} + ${ICECAST_ADMIN_USER} + ${ICECAST_ADMIN_PASSWORD} + + + ${ICECAST_HOST} + + + ${ICECAST_PORT} + + + + ${ICECAST_MOUNT} + + + + 100 + 2 + + + + 0 + +