-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #128 from signalwire/gha
[GHA] Migrate to new project layout.
- Loading branch information
Showing
12 changed files
with
433 additions
and
683 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,35 @@ | ||
ARG BUILDER_IMAGE=debian:bookworm | ||
ARG MAINTAINER="Andrey Volk <[email protected]>" | ||
ARG BUILDER_IMAGE=debian:bookworm-20240513 | ||
|
||
FROM ${BUILDER_IMAGE} AS builder | ||
|
||
ARG MAINTAINER_NAME="Andrey Volk" | ||
ARG MAINTAINER_EMAIL="[email protected]" | ||
|
||
ARG CODENAME=bookworm | ||
ARG ARCH=amd64 | ||
|
||
# Credentials | ||
ARG REPO_DOMAIN=freeswitch.signalwire.com | ||
ARG REPO_USERNAME=user | ||
ARG REPO_PASSWORD=password | ||
|
||
ARG BUILD_NUMBER=42 | ||
ARG GIT_SHA=0000000000 | ||
|
||
ARG GPG_KEY="/usr/share/keyrings/signalwire-freeswitch-repo.gpg" | ||
|
||
MAINTAINER ${MAINTAINER} | ||
ARG DATA_DIR=/data | ||
|
||
LABEL maintainer="${MAINTAINER_NAME} <${MAINTAINER_EMAIL}>" | ||
|
||
SHELL ["/bin/bash", "-c"] | ||
|
||
RUN apt-get -q update && \ | ||
DEBIAN_FRONTEND=noninteractive apt-get -yq install \ | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
RUN apt-get -q update \ | ||
&& apt-get -y -q install \ | ||
apt-transport-https \ | ||
autoconf \ | ||
automake \ | ||
build-essential \ | ||
ca-certificates \ | ||
cmake \ | ||
|
@@ -29,50 +39,59 @@ RUN apt-get -q update && \ | |
dh-autoreconf \ | ||
dos2unix \ | ||
doxygen \ | ||
dpkg-dev \ | ||
git \ | ||
gnupg2 \ | ||
graphviz \ | ||
libglib2.0-dev \ | ||
libssl-dev \ | ||
lsb-release \ | ||
pkg-config \ | ||
unzip \ | ||
wget | ||
|
||
RUN update-ca-certificates --fresh | ||
|
||
ENV DATA_DIR=/data | ||
WORKDIR ${DATA_DIR} | ||
|
||
COPY . ${DATA_DIR} | ||
RUN git reset --hard HEAD && git clean -xfd | ||
|
||
RUN echo "export CODENAME=$(lsb_release -sc | tr -d '\n')" | tee ~/.env && \ | ||
chmod +x ~/.env | ||
RUN echo "export CODENAME=${CODENAME}" | tee ~/.env \ | ||
&& echo "export ARCH=${ARCH}" | tee -a ~/.env \ | ||
&& chmod +x ~/.env | ||
|
||
RUN . ~/.env && cat <<EOF > /etc/apt/sources.list.d/freeswitch.list | ||
deb [signed-by=${GPG_KEY}] https://${REPO_DOMAIN}/repo/deb/debian-release ${CODENAME} main | ||
deb-src [signed-by=${GPG_KEY}] https://${REPO_DOMAIN}/repo/deb/debian-release ${CODENAME} main | ||
EOF | ||
|
||
RUN --mount=type=secret,id=REPO_PASSWORD \ | ||
printf "machine ${REPO_DOMAIN} " > ~/.netrc && \ | ||
printf "login ${REPO_USERNAME} " >> ~/.netrc && \ | ||
printf "password " >> ~/.netrc && \ | ||
cat /run/secrets/REPO_PASSWORD >> ~/.netrc && \ | ||
cp -f ~/.netrc /etc/apt/auth.conf | ||
|
||
RUN git config --global --add safe.directory '*' | ||
|
||
RUN curl --netrc -o ${GPG_KEY} https://${REPO_DOMAIN}/repo/deb/debian-release/signalwire-freeswitch-repo.gpg | ||
RUN git config --global --add safe.directory '*' \ | ||
&& git config --global user.name "${MAINTAINER_NAME}" \ | ||
&& git config --global user.email "${MAINTAINER_EMAIL}" | ||
|
||
RUN --mount=type=secret,id=REPO_PASSWORD,required=true \ | ||
printf "machine ${REPO_DOMAIN} " > /etc/apt/auth.conf && \ | ||
printf "login ${REPO_USERNAME} " >> /etc/apt/auth.conf && \ | ||
printf "password " >> /etc/apt/auth.conf && \ | ||
cat /run/secrets/REPO_PASSWORD >> /etc/apt/auth.conf && \ | ||
sha512sum /run/secrets/REPO_PASSWORD && \ | ||
curl \ | ||
--fail \ | ||
--netrc-file /etc/apt/auth.conf \ | ||
--output ${GPG_KEY} \ | ||
https://${REPO_DOMAIN}/repo/deb/debian-release/signalwire-freeswitch-repo.gpg && \ | ||
file ${GPG_KEY} && \ | ||
apt-get --quiet update && \ | ||
apt-get --yes --quiet install \ | ||
libks2 \ | ||
&& rm -f /etc/apt/auth.conf | ||
|
||
# Bootstrap and Build | ||
RUN apt-get -q update && \ | ||
DEBIAN_FRONTEND=noninteractive apt-get -yq install \ | ||
libks2 | ||
COPY . ${DATA_DIR} | ||
WORKDIR ${DATA_DIR} | ||
|
||
RUN PACKAGE_RELEASE="${BUILD_NUMBER}.${GIT_SHA}" cmake . \ | ||
-DCMAKE_BUILD_TYPE=Debug \ | ||
-DCMAKE_INSTALL_PREFIX="/usr" && \ | ||
make package && mkdir OUT && mv -v *.deb OUT/. | ||
-DCMAKE_BUILD_TYPE=Debug \ | ||
-DCMAKE_INSTALL_PREFIX="/usr" \ | ||
&& make package \ | ||
&& mkdir OUT \ | ||
&& mv -v *.deb OUT/. | ||
|
||
# Artifacts image (mandatory part, the resulting image must have a single filesystem layer) | ||
FROM scratch | ||
|
Oops, something went wrong.