From ce52a579f1beaeb65fbae5166b2579caab7ec3de Mon Sep 17 00:00:00 2001
From: Eduardo Trujillo <ed@chromabits.com>
Date: Tue, 28 Dec 2021 12:05:36 -0800
Subject: [PATCH] Add initial version

---
 Dockerfile         |  5 +++++
 darkice.cfg        | 23 +++++++++++++++++++++++
 docker-compose.yml | 16 ++++++++++++++++
 icecast.xml        |  5 +++++
 4 files changed, 49 insertions(+)
 create mode 100644 Dockerfile
 create mode 100644 darkice.cfg
 create mode 100644 docker-compose.yml
 create mode 100644 icecast.xml

diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..8dad183
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,5 @@
+FROM debian
+
+RUN useradd -ms /bin/bash icecast2
+RUN apt update -y && apt install -y icecast2 darkice
+RUN usermod -G icecast -a icecast2
diff --git a/darkice.cfg b/darkice.cfg
new file mode 100644
index 0000000..7542efb
--- /dev/null
+++ b/darkice.cfg
@@ -0,0 +1,23 @@
+[general]
+duration        = 0
+bufferSecs      = 1
+reconnect       = yes
+realtime        = yes
+rtprio          = 3
+
+[input]
+device          = pulseaudio
+sampleRate      = 44100
+bitsPerSample   = 16
+channel         = 2
+paSourceName    = alsa_input.pci-0000_00_1f.3.analog-stereo
+
+[icecast2-0]
+bitrateMode     = vbr
+format          = mp3
+quality         = 0.8
+server          = localhost
+port            = 8000
+password        = <pwd>
+mountPoint      = sonos
+name            = sonos
diff --git a/docker-compose.yml b/docker-compose.yml
new file mode 100644
index 0000000..d8fd225
--- /dev/null
+++ b/docker-compose.yml
@@ -0,0 +1,16 @@
+version: "3.9"
+services:
+  icecast2:
+    build: .
+    command: icecast2 -c /etc/icecast2/icecast.xml
+    user: icecast2
+  darkice:
+    build: .
+    depends_on:
+      - icecast2
+    command: darkice
+    user: icecast2
+    volumes:
+      - ./darkice.cfg:/etc/darkice.cfg:z
+      - /run/user/1000/pulse:/run/user/1000/pulse
+
diff --git a/icecast.xml b/icecast.xml
new file mode 100644
index 0000000..a2ff094
--- /dev/null
+++ b/icecast.xml
@@ -0,0 +1,5 @@
+<limits>
+    <burst-on-connect>0</burst-on-connect>
+    <burst-size>0</burst-size>
+</limits>
+
-- 
GitLab