diff --git a/Dockerfile b/Dockerfile index 9dc202a2d7cc2c4a0e896e106670c35bfeaf1be2..3b93382efee33e193936de7030ed41e44164d4b4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,46 +1,83 @@ -###--- Python Stage ---### - FROM ocaml/opam2:debian-10 LABEL maintainer="David Trattnig <david.trattnig@subsquare.at>" +USER root -RUN set -ex \ - && rm -f /usr/bin/python && ln -s /usr/local/bin/python /usr/bin/python \ - && rm -f /usr/bin/python3 && ln -s /usr/local/bin/python3 /usr/bin/python3 +# Engine System Dependencies -# System Package Installation -RUN set -ex \ - && apt-get update -q \ - && apt-get install -y -q --no-install-recommends \ - supervisor \ +RUN apt-get update && sudo apt-get -y install \ + apt-utils \ redis-server \ libsndfile1 \ ffmpeg \ quelcom \ - && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + python3-pip \ + python-dev \ + libmariadbclient-dev \ + default-libmysqlclient-dev -# Python Package Installation -COPY requirements.txt /tmp/requirements.txt -RUN pip3 install -r /tmp/requirements.txt +# Liquidsoap System Dependencies + +RUN apt-get install -qq -yy \ + libasound2-dev \ + libflac-dev \ + libjack-dev \ + libmad0-dev \ + libmp3lame-dev \ + libogg-dev \ + libopus-dev \ + libpcre3-dev \ + libpulse-dev \ + libsamplerate0-dev \ + libssl-dev \ + libtag1-dev \ + libvorbis-dev \ + m4 \ + pkg-config # Create Users + RUN set -ex \ - && adduser --home /srv --no-create-home --system --uid 1000 --group engineuser \ - && adduser engineuser audio + && adduser --home /srv --no-create-home --system --uid 1001 --group engineuser \ + && adduser engineuser audio \ + && adduser engineuser opam -# Default configuration -COPY configuration/sample-docker.engine.ini configuration/engine.ini -COPY configuration/sample-docker.gunicorn.conf.py configuration/gunicorn.conf.py +# Initialize the project structure +RUN mkdir -p /srv +RUN mkdir -p /var/log/aura +COPY . /srv +# Own'd +RUN chown -R engineuser:engineuser /srv +RUN chown -R engineuser:engineuser /var/log/aura +RUN chown -R engineuser:engineuser /home/opam -# Liquidsoap Dependencies + +# ENGINE INSTALLATION + +USER engineuser +WORKDIR /srv +ENV PATH="/home/opam/.local/bin:${PATH}" + +# Python Package Installation +COPY requirements.txt /tmp/requirements.txt +RUN pip3 install -r /tmp/requirements.txt + + +# Default configuration +COPY configuration/sample-docker.engine.ini /srv/configuration/engine.ini +COPY configuration/sample-docker.gunicorn.conf.py /srv/configuration/gunicorn.conf.py + +# Update OPAM RUN opam init --disable-sandboxing -y RUN opam switch create 4.08.0 RUN opam update -y RUN opam install depext -y + +# Liquidsoap Dependencies RUN opam depext taglib mad lame vorbis flac opus cry samplerate pulseaudio bjack alsa ssl liquidsoap -y RUN opam install taglib mad lame vorbis flac opus cry samplerate pulseaudio bjack alsa ssl liquidsoap -y RUN eval $(opam env) \ No newline at end of file