Adding docker machinery

This commit is contained in:
Blallo 2021-09-15 07:51:58 +02:00
parent 17e3539085
commit e4933bd3f0
No known key found for this signature in database
GPG key ID: 0CBE577C9B72DC3F
7 changed files with 123 additions and 0 deletions

28
Dockerfile Normal file
View file

@ -0,0 +1,28 @@
FROM python
ARG uid=1000
ARG gid=1000
ENV TECHREC_CONFIG=/src/techrec/docker/config.py
ENV DEBIAN_FRONTEND=noninteractive
WORKDIR /src
COPY . /src/techrec
RUN groupadd -g ${gid} techrec \
&& useradd -g techrec -u ${uid} -m techrec \
&& mkdir -p /src/techrec \
&& chown -R techrec:techrec /src \
&& apt-get update \
&& apt-get install -y ffmpeg \
&& rm -rf /var/lib/apt/lists/*
USER techrec
RUN python -m venv ./venv \
&& ./venv/bin/python -m pip install wheel \
&& ./venv/bin/python -m pip install -e ./techrec
ENTRYPOINT ["/src/venv/bin/techrec"]
CMD ["-vv", "serve"]

46
docker-compose.yaml Normal file
View file

@ -0,0 +1,46 @@
version: "3"
services:
liquidsoap:
build:
context: .
dockerfile: docker/Dockerfile.liquidsoap
volumes:
- ./docker/run.liq:/run.liq
- ./docker/ror.sh:/ror.sh
- rec:/rec
devices:
- /dev/snd:/dev/snd
entrypoint: /run.liq
depends_on:
- storageprepare
storage:
image: nginx
volumes:
- rec:/var/www/rec
- ./docker/storage.conf:/etc/nginx/conf.d/default.conf:ro
ports:
- 18080:80
depends_on:
- storageprepare
storageprepare:
image: bash
volumes:
- rec:/rec
command: chmod 777 /rec
techrec:
build: .
volumes:
- .:/src/techrec
- ./docker/output:/src/output
ports:
- 8000:8000
depends_on:
- liquidsoap
- storage
volumes:
rec:

View file

@ -0,0 +1,10 @@
FROM savonet/liquidsoap:main
ENV audiogid=995
USER root
RUN groupadd -g ${audiogid} hostaudio \
&& usermod -a -G hostaudio liquidsoap
USER liquidsoap

4
docker/config.py Normal file
View file

@ -0,0 +1,4 @@
AUDIO_INPUT = "http://storage/ror"
AUDIO_OUTPUT = "/src/output"
HOST = "0.0.0.0"
PORT = 8000

0
docker/output/.gitkeep Normal file
View file

26
docker/run.liq Executable file
View file

@ -0,0 +1,26 @@
#!/usr/bin/liquidsoap
settings.log.stdout.set(true);
settings.log.file.set(false);
settings.log.level.set(3);
# settings.server.telnet.set(true);
# settings.server.telnet.bind_addr.set("127.0.0.1");
# settings.server.telnet.port.set(6666);
rorinput = input.alsa(device="default", bufferize=true);
#rorinput = input.pulseaudio( );
# rorinput = insert_metadata(id="trx",rorinput);
rorinput = rewrite_metadata([("artist","Radio OndaRossa")],rorinput);
# ESCPOST
output.file(
id="rorrec",
reopen_when={0m},
#%mp3(bitrate=80, samplerate=44100, stereo=true,stereo_mode="joint_stereo"),
#"/rec/ror/%Y-%m/%d/rec-%Y-%m-%d-%H-%M-%S-ror.mp3",
%vorbis(quality=0.3, samplerate=44100, channels=2),
"/rec/ror/%Y-%m/%d/rec-%Y-%m-%d-%H-%M-%S-ror.ogg",
rorinput
);

9
docker/storage.conf Normal file
View file

@ -0,0 +1,9 @@
server {
listen 80 default_server;
server_name storage;
location / {
root /var/www/rec;
autoindex on;
}
}