From 3d6bf0f204abe5e29b778aa3bed6919e3dc70053 Mon Sep 17 00:00:00 2001 From: Maksym Sobolyev Date: Wed, 10 Jul 2024 21:13:50 -0700 Subject: [PATCH] Add simple build system. --- .github/workflows/build.yml | 72 +++++++++++++++++++++++++++++++++++++ Dockerfile | 16 +++++++++ build.sh | 11 ++++++ 3 files changed, 99 insertions(+) create mode 100644 .github/workflows/build.yml create mode 100644 Dockerfile create mode 100755 build.sh diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..72b7db3 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,72 @@ +name: Build Docker image + +# Controls when the action will run. +on: + # Triggers the workflow on all push or pull request events + push: + pull_request: + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + + schedule: + - cron: "0 0 * * *" + +# added using https://github.com/step-security/secure-repo +permissions: + contents: read + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + Docker: + name: Build&Push to DockerHub + runs-on: ubuntu-latest + env: + DOCKER_REPO: sippylabs/webrtc_phone + PLATFORMS: linux/amd64 #,linux/i386,linux/arm/v7,linux/arm64 + BASE_IMAGE: sippylabs/rtpproxy:RFC5245_ICE + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + submodules: 'recursive' + + - name: Set up QEMU + id: qemu + uses: docker/setup-qemu-action@v2 + with: + platforms: arm64,arm + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Log in to Docker Hub + if: github.event_name != 'pull_request' + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v3 + with: + images: ${{ env.DOCKER_REPO }} + tags: | + type=schedule + type=ref,event=branch + type=ref,event=tag + type=ref,event=pr + type=raw,value=latest,enable={{is_default_branch}} + type=sha + + - name: Build Docker image + uses: docker/build-push-action@v4 + with: + context: . + file: ./Dockerfile + build-args: BASE_IMAGE=${{ env.BASE_IMAGE }} + tags: | + ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + platforms: ${{ env.PLATFORMS }} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..3f4afae --- /dev/null +++ b/Dockerfile @@ -0,0 +1,16 @@ +ARG BASE_IMAGE +FROM --platform=$TARGETPLATFORM $BASE_IMAGE as build +LABEL maintainer="Maksym Sobolyev " + +USER root + +# Set Environment Variables +ENV DEBIAN_FRONTEND noninteractive + +WORKDIR /webrtc_phone +COPY . /webrtc_phone/ + +# Build & install everything +RUN /webrtc_phone/build.sh + +ENTRYPOINT ["/bin/echo", "done"] diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..bf8b8da --- /dev/null +++ b/build.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +set -x +set -e + +apt-get -y update -qq +apt-get -y install git python-is-python3 python3-pip + +git clone -b RFC7118 https://github.com/sippy/b2bua + +python3 -m pip install --break-system-packages -U -r b2bua/requirements.txt