Skip to content

Commit 19fbd9a

Browse files
authored
Merge pull request #15 from freeswitch/build
[GHA]: Add build workflow.
2 parents 7cb6cf0 + a594a86 commit 19fbd9a

20 files changed

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

Comments
 (0)