Dockerfile 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. ARG BUILDER_IMAGE=arm32v7/debian:bookworm-20240513
  2. FROM --platform=linux/arm32 ${BUILDER_IMAGE} AS builder
  3. ARG MAINTAINER_NAME="Andrey Volk"
  4. ARG MAINTAINER_EMAIL="andrey@signalwire.com"
  5. # Credentials
  6. ARG REPO_DOMAIN=freeswitch.signalwire.com
  7. ARG REPO_USERNAME=user
  8. ARG BUILD_NUMBER=42
  9. ARG GIT_SHA=0000000000
  10. ARG DATA_DIR=/data
  11. ARG CODENAME=bookworm
  12. ARG GPG_KEY="/usr/share/keyrings/signalwire-freeswitch-repo.gpg"
  13. MAINTAINER "${MAINTAINER_NAME} <${MAINTAINER_EMAIL}>"
  14. SHELL ["/bin/bash", "-c"]
  15. RUN apt-get -q update && \
  16. DEBIAN_FRONTEND=noninteractive apt-get -yq install \
  17. apt-transport-https \
  18. build-essential \
  19. ca-certificates \
  20. cmake \
  21. curl \
  22. debhelper \
  23. devscripts \
  24. dh-autoreconf \
  25. dos2unix \
  26. doxygen \
  27. git \
  28. graphviz \
  29. libglib2.0-dev \
  30. libssl-dev \
  31. lsb-release \
  32. pkg-config \
  33. wget
  34. RUN update-ca-certificates --fresh
  35. RUN echo "export CODENAME=${CODENAME}" | tee ~/.env && \
  36. chmod +x ~/.env
  37. RUN . ~/.env && cat <<EOF > /etc/apt/sources.list.d/freeswitch.list
  38. deb [signed-by=${GPG_KEY}] https://${REPO_DOMAIN}/repo/deb/rpi/debian-dev ${CODENAME} main
  39. deb-src [signed-by=${GPG_KEY}] https://${REPO_DOMAIN}/repo/deb/rpi/debian-dev ${CODENAME} main
  40. EOF
  41. RUN git config --global --add safe.directory '*' \
  42. && git config --global user.name "${MAINTAINER_NAME}" \
  43. && git config --global user.email "${MAINTAINER_EMAIL}"
  44. # Bootstrap and Build
  45. COPY . ${DATA_DIR}
  46. WORKDIR ${DATA_DIR}
  47. RUN echo "export VERSION=$(cat ./build/next-release.txt | tr -d '\n')" | tee -a ~/.env
  48. RUN . ~/.env && ./debian/util.sh prep-create-orig -n -V${VERSION}-${BUILD_NUMBER}-${GIT_SHA} -x
  49. RUN . ~/.env && ./debian/util.sh prep-create-dsc -a armhf ${CODENAME}
  50. RUN --mount=type=secret,id=REPO_PASSWORD,required=true \
  51. printf "machine ${REPO_DOMAIN} " > /etc/apt/auth.conf && \
  52. printf "login ${REPO_USERNAME} " >> /etc/apt/auth.conf && \
  53. printf "password " >> /etc/apt/auth.conf && \
  54. cat /run/secrets/REPO_PASSWORD >> /etc/apt/auth.conf && \
  55. sha512sum /run/secrets/REPO_PASSWORD && \
  56. curl \
  57. --fail \
  58. --netrc-file /etc/apt/auth.conf \
  59. --output ${GPG_KEY} \
  60. https://${REPO_DOMAIN}/repo/deb/rpi/debian-dev/signalwire-freeswitch-repo.gpg && \
  61. file ${GPG_KEY} && \
  62. apt-get --quiet update && \
  63. mk-build-deps \
  64. --install \
  65. --remove debian/control \
  66. --tool "apt-get --yes --no-install-recommends" && \
  67. apt-get --yes --fix-broken install && \
  68. rm -f /etc/apt/auth.conf
  69. ENV DEB_BUILD_OPTIONS="parallel=1"
  70. RUN . ~/.env && dch -b -M -v "${VERSION}-${BUILD_NUMBER}-${GIT_SHA}~${CODENAME}" \
  71. --force-distribution -D "${CODENAME}" "Nightly build, ${GIT_SHA}"
  72. RUN . ~/.env && ./debian/util.sh create-orig -n -V${VERSION}-${BUILD_NUMBER}-${GIT_SHA} -x
  73. RUN dpkg-source \
  74. --diff-ignore=.* \
  75. --compression=xz \
  76. --compression-level=9 \
  77. --build \
  78. . \
  79. && debuild -b -us -uc \
  80. && mkdir OUT \
  81. && mv -v ../*.{deb,dsc,changes,tar.*} OUT/.
  82. # Artifacts image (mandatory part, the resulting image must have a single filesystem layer)
  83. FROM scratch
  84. COPY --from=builder /data/OUT/ /