Debian Codegraph @

Dockerfile

raw
1 # JackTrip container image using Redhat Universal Base Image ubi-init
2 #
3 # Copyright (c) 2023-2024 JackTrip Labs, Inc.
4 # MIT License.
5 #
6 # To build this from repository root: "podman build -t jacktrip/jacktrip ."
7
8 # container image versions
9 ARG FEDORA_VERSION=34
10 ARG JACK_VERSION=latest
11
12
13 ###############
14 # STAGE BUILDER
15 ###############
16 # use a temporary container to build jacktrip
17 FROM registry.fedoraproject.org/fedora:${FEDORA_VERSION} AS builder
18
19 # install tools require to build jacktrip
20 RUN dnf install -y --nodocs cmake gcc gcc-c++ meson git perl python3-pyyaml python3-jinja2 glib2-devel jack-audio-connection-kit-devel dbus-devel libatomic-static
21
22 ENV QT_VERSION=6.8.3
23 RUN if [ "$(uname -m)" = "x86_64" ]; then export ARCH=amd64; else export ARCH=arm64; fi \
24 && curl -L -s -o /root/qt.tar.gz "https://files.jacktrip.org/contrib/qt/qt-${QT_VERSION}-static-linux-${ARCH}.tar.gz" \
25 && tar -C /opt -xzf /root/qt.tar.gz \
26 && rm -f /root/qt.tar.gz
27
28 # copy files from repository to build container
29 COPY . /root
30
31 # configure and run the build
32 RUN cd /root \
33 && export QT_PATH=/opt/qt-${QT_VERSION}-static \
34 && export PATH=${QT_PATH}/bin:${PATH} \
35 && export LDFLAGS="-L${QT_PATH}/lib -L${QT_PATH}/plugins/tls" \
36 && meson setup -Dpkg_config_path=/opt/qt-${QT_VERSION}-static/lib/pkgconfig -Dlibdatachannel=enabled -Dmsquic=enabled -Ddefault_library=static -Dnogui=true --buildtype release builddir \
37 && meson compile -C builddir
38
39 # stage files in INSTALLDIR
40 ENV INSTALLDIR=/artifacts
41 RUN mkdir -p ${INSTALLDIR}/usr/local/bin/ ${INSTALLDIR}/etc/systemd/system/ \
42 && cp /root/builddir/jacktrip ${INSTALLDIR}/usr/local/bin/ \
43 && strip ${INSTALLDIR}/usr/local/bin/jacktrip
44 COPY linux/container/jacktrip.service ${INSTALLDIR}/etc/systemd/system/
45
46
47 ########################
48 # STAGE JACKTRIP (FINAL)
49 ########################
50 # use the jack ubi-init container
51 FROM jacktrip/jack:${JACK_VERSION}
52
53 # add jacktrip user, enable service and allow access to jackd
54 RUN useradd -r -m -N -G audio -s /usr/sbin/nologin jacktrip \
55 && chown -R jacktrip.audio /home/jacktrip \
56 && chmod g+rwx /home/jacktrip \
57 && ln -s /etc/systemd/system/jacktrip.service /etc/systemd/system/multi-user.target.wants \
58 && sed -i 's,PassEnvironment=.*,PassEnvironment=SAMPLE_RATE BUFFER_SIZE JACK_OPTS JACKTRIP_OPTS,' /etc/systemd/system/defaults.service \
59 && sed -i 's,WantedBy=.*,WantedBy=multi-user.target jack.service jacktrip.service,' /etc/systemd/system/defaults.service \
60 && echo 'if [[ -z "$JACKTRIP_OPTS" ]]; then JACKTRIP_OPTS="-S -t -z --hubpatch 4 --bufstrategy 4 -q auto"; fi' >> /usr/sbin/defaults.sh \
61 && echo 'echo "JACKTRIP_OPTS=\"$JACKTRIP_OPTS\"" > /etc/default/jacktrip' >> /usr/sbin/defaults.sh
62
63 # copy the artifacts we built into the final container image
64 COPY --from=builder /artifacts /
65
66 # jacktrip hub server listens on 4464 and uses 61000+ for clients
67 EXPOSE 4464/tcp
68 EXPOSE 4464/udp
69 EXPOSE 61000-61100/udp