|
| 1 | +ARG BUILDER_IMAGE=debian:bookworm-20240513 |
| 2 | + |
| 3 | +FROM ${BUILDER_IMAGE} AS builder |
| 4 | + |
| 5 | +ARG MAINTAINER_NAME="Andrey Volk" |
| 6 | +ARG MAINTAINER_EMAIL= "[email protected]" |
| 7 | + |
| 8 | +ARG CODENAME=bookworm |
| 9 | +ARG ARCH=amd64 |
| 10 | + |
| 11 | +# Credentials |
| 12 | +ARG REPO_DOMAIN=freeswitch.signalwire.com |
| 13 | +ARG REPO_USERNAME=user |
| 14 | + |
| 15 | +ARG BUILD_NUMBER=42 |
| 16 | +ARG GIT_SHA=0000000000 |
| 17 | + |
| 18 | +ARG GPG_KEY="/usr/share/keyrings/signalwire-freeswitch-repo.gpg" |
| 19 | + |
| 20 | +ARG DATA_DIR=/data |
| 21 | + |
| 22 | +LABEL maintainer="${MAINTAINER_NAME} <${MAINTAINER_EMAIL}>" |
| 23 | + |
| 24 | +SHELL ["/bin/bash", "-c"] |
| 25 | + |
| 26 | +ENV DEBIAN_FRONTEND=noninteractive |
| 27 | + |
| 28 | +RUN apt-get -q update \ |
| 29 | + && apt-get -y -q install \ |
| 30 | + apt-transport-https \ |
| 31 | + autoconf \ |
| 32 | + automake \ |
| 33 | + build-essential \ |
| 34 | + ca-certificates \ |
| 35 | + cmake \ |
| 36 | + curl \ |
| 37 | + debhelper \ |
| 38 | + devscripts \ |
| 39 | + dh-autoreconf \ |
| 40 | + dos2unix \ |
| 41 | + doxygen \ |
| 42 | + dpkg-dev \ |
| 43 | + git \ |
| 44 | + gnupg2 \ |
| 45 | + graphviz \ |
| 46 | + libglib2.0-dev \ |
| 47 | + libssl-dev \ |
| 48 | + lsb-release \ |
| 49 | + pkg-config \ |
| 50 | + unzip \ |
| 51 | + wget |
| 52 | + |
| 53 | +RUN update-ca-certificates --fresh |
| 54 | + |
| 55 | +RUN echo "export CODENAME=${CODENAME}" | tee ~/.env \ |
| 56 | + && echo "export ARCH=${ARCH}" | tee -a ~/.env \ |
| 57 | + && chmod +x ~/.env |
| 58 | + |
| 59 | +RUN . ~/.env && cat <<EOF > /etc/apt/sources.list.d/freeswitch.list |
| 60 | +deb [signed-by=${GPG_KEY}] https://${REPO_DOMAIN}/repo/deb/debian-release ${CODENAME} main |
| 61 | +deb-src [signed-by=${GPG_KEY}] https://${REPO_DOMAIN}/repo/deb/debian-release ${CODENAME} main |
| 62 | +EOF |
| 63 | + |
| 64 | +RUN git config --global --add safe.directory '*' \ |
| 65 | + && git config --global user.name "${MAINTAINER_NAME}" \ |
| 66 | + && git config --global user.email "${MAINTAINER_EMAIL}" |
| 67 | + |
| 68 | +RUN --mount=type=secret,id=REPO_PASSWORD,required=true \ |
| 69 | + printf "machine ${REPO_DOMAIN} " > /etc/apt/auth.conf && \ |
| 70 | + printf "login ${REPO_USERNAME} " >> /etc/apt/auth.conf && \ |
| 71 | + printf "password " >> /etc/apt/auth.conf && \ |
| 72 | + cat /run/secrets/REPO_PASSWORD >> /etc/apt/auth.conf && \ |
| 73 | + sha512sum /run/secrets/REPO_PASSWORD && \ |
| 74 | + curl \ |
| 75 | + --fail \ |
| 76 | + --netrc-file /etc/apt/auth.conf \ |
| 77 | + --output ${GPG_KEY} \ |
| 78 | + https://${REPO_DOMAIN}/repo/deb/debian-release/signalwire-freeswitch-repo.gpg && \ |
| 79 | + file ${GPG_KEY} && \ |
| 80 | + apt-get --quiet update && \ |
| 81 | + apt-get --yes --quiet install \ |
| 82 | + libexpat1-dev \ |
| 83 | + libfreeswitch-dev \ |
| 84 | + libfreeswitch1 \ |
| 85 | + libks2 \ |
| 86 | + libsofia-sip-ua-dev \ |
| 87 | + libspandsp3-dev \ |
| 88 | + signalwire-client-c2 \ |
| 89 | + && rm -f /etc/apt/auth.conf |
| 90 | + |
| 91 | +# Bootstrap and Build |
| 92 | +RUN wget -O - https://www.unimrcp.org/project/component-view/unimrcp-deps-1-6-0-tar-gz/download \ |
| 93 | + | tar xvz -C /root |
| 94 | + |
| 95 | +WORKDIR /root/unimrcp-deps-1.6.0/libs/apr |
| 96 | +RUN CFLAGS="-fPIC" ./configure \ |
| 97 | + --disable-shared \ |
| 98 | + --enable-static \ |
| 99 | + --prefix=/usr/local/apr \ |
| 100 | + && make install |
| 101 | + |
| 102 | +WORKDIR /root/unimrcp-deps-1.6.0/libs/apr-util |
| 103 | +RUN CFLAGS="-fPIC" ./configure \ |
| 104 | + --prefix=/usr/local/apr \ |
| 105 | + --with-apr=/usr/local/apr \ |
| 106 | + --with-expat=/usr \ |
| 107 | + && make install |
| 108 | + |
| 109 | +WORKDIR /root |
| 110 | +RUN git clone https://github.com/unispeech/unimrcp.git |
| 111 | + |
| 112 | +WORKDIR /root/unimrcp |
| 113 | +RUN ./bootstrap \ |
| 114 | + && ./configure \ |
| 115 | + --with-sofia-sip=/usr \ |
| 116 | + && make install |
| 117 | +COPY . ${DATA_DIR} |
| 118 | +WORKDIR ${DATA_DIR} |
| 119 | + |
| 120 | +ENV UNIMRCP_CFLAGS="-I/usr/local/unimrcp/include -I/usr/local/apr/include/apr-1/" |
| 121 | +ENV UNIMRCP_LIBS="/usr/local/unimrcp/lib/libunimrcpclient.a /usr/local/apr/lib/libaprutil-1.a /usr/local/apr/lib/libapr-1.a -lexpat -lsofia-sip-ua -luuid -lcrypt -lpthread -lm" |
| 122 | + |
| 123 | +#RUN ./bootstrap.sh \ |
| 124 | +# && ./configure \ |
| 125 | +# && make install |
| 126 | + |
| 127 | +RUN . ~/.env \ |
| 128 | + && dch \ |
| 129 | + --controlmaint \ |
| 130 | + --distribution "${CODENAME}" \ |
| 131 | + --force-bad-version \ |
| 132 | + --force-distribution \ |
| 133 | + --newversion "${BUILD_NUMBER}-${GIT_SHA}~${CODENAME}" \ |
| 134 | + --package "freeswitch-mod-unimrcp" \ |
| 135 | + "Build, ${GIT_SHA}" \ |
| 136 | + && debuild \ |
| 137 | + --preserve-env \ |
| 138 | + --no-tgz-check \ |
| 139 | + --build=binary \ |
| 140 | + --unsigned-source \ |
| 141 | + --unsigned-changes \ |
| 142 | + && mkdir OUT \ |
| 143 | + && mv -v ../*.{deb,changes} OUT/. |
| 144 | + |
| 145 | +# Artifacts image (mandatory part, the resulting image must have a single filesystem layer) |
| 146 | +FROM scratch |
| 147 | +COPY --from=builder /data/OUT/ / |
0 commit comments