From 1fb9799e20bda4bccea534c8f4b02b77531b5375 Mon Sep 17 00:00:00 2001 From: Dejan Jovasevic Date: Mon, 4 Sep 2023 16:31:06 +0200 Subject: [PATCH] Docker save and set as release artifact - The release and tag will be created before this is run - Use the shell script to create the docker image from sources -> Save the image and gzip it -> Upload it to created release --- .github/workflows/build.yml | 32 +++++++++++++++++++++++++++++--- setup/docker.sh | 15 ++++++++------- 2 files changed, 37 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ddd3ac2..1126ac7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,7 +1,7 @@ name: Build RTME env: - DOCKER_HUB_REPO: "voxeet/real-time-media-extensions" + DOCKER_HUB_REPO: "dolbyio/real-time-media-extensions" on: pull_request: @@ -48,9 +48,10 @@ jobs: name: docker-resource path: docker-resource.zip retention-days: 1 - + + # Disable this job for now until repo is set build-deploy-docker: - if: github.ref_type == 'tag' + if: false runs-on: ubuntu-20.04 needs: build-resources steps: @@ -87,3 +88,28 @@ jobs: push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + + build-save-docker: + if: github.ref_type == 'tag' + runs-on: ubuntu-20.04 + needs: build-resources + permissions: + contents: write + packages: write + steps: + - name: Check out repository code + uses: actions/checkout@v3 + + - name: Download docker resources + uses: actions/download-artifact@v3 + with: + name: docker-resource + + - name: Build, save and release docker + env: + GITHUB_TOKEN: ${{ github.token }} + run: | + unzip docker-resource.zip && rm docker-resource.zip + sudo bash setup/linux.sh --build_docker ${{ env.DOCKER_HUB_REPO }} ${GITHUB_REF_NAME} --skip_building + sudo chmod 777 dolbyio_rtme-${GITHUB_REF_NAME}.tar.gz + gh release upload ${GITHUB_REF_NAME} dolbyio_rtme-${GITHUB_REF_NAME}.tar.gz diff --git a/setup/docker.sh b/setup/docker.sh index 1184465..bae0739 100644 --- a/setup/docker.sh +++ b/setup/docker.sh @@ -29,11 +29,12 @@ prepare_docker_image() { } build_docker_image() { - docker_repo=${1} - docker_tag=${2} - pushd ${WORK_DIR} - docker build -t ${docker_repo}:${docker_tag} -f Dockerfile --no-cache . - docker save --output dolbyio_rtme-${docker_tag}.tar ${docker_repo}:${docker_tag} - gzip -9 dolbyio_rtme-${docker_tag}.tar - popd + docker_repo=${1} + docker_tag=${2} + pushd ${WORK_DIR} + docker build -t ${docker_repo}:${docker_tag} -f Dockerfile --no-cache . + docker save --output dolbyio_rtme-${docker_tag}.tar ${docker_repo}:${docker_tag} + gzip -9 dolbyio_rtme-${docker_tag}.tar + ls -l + popd }