Skip to content
This repository has been archived by the owner on Aug 30, 2024. It is now read-only.

Commit

Permalink
Docker publish to GHCR
Browse files Browse the repository at this point in the history
- Disable the DockerHub job until further notice
- Add GHCR publishing
  • Loading branch information
djova-dolby committed Sep 5, 2023
1 parent 426e820 commit 9a85f50
Showing 1 changed file with 64 additions and 20 deletions.
84 changes: 64 additions & 20 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
name: Build RTME

env:
DOCKER_HUB_REPO: "dolbyio/real-time-media-extensions"
GHCR: "ghcr.io"
DOCKER_IMAGE_NAME: "dolbyio/real-time-media-extensions"

on:
pull_request:
Expand Down Expand Up @@ -49,11 +50,37 @@ jobs:
path: docker-resource.zip
retention-days: 1

# Disable this job for now until repo is set
build-deploy-docker:
if: false
# Add the docker image to the release
docker-release-artifact:
if: github.ref_type == 'tag'
runs-on: ubuntu-20.04
needs: build-resources
permissions:
contents: 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_IMAGE_NAME }} ${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
docker-ghcr-publish:
if: github.ref_type == 'tag'
runs-on: ubuntu-20.04
needs: build-resources
permissions:
packages: write
steps:
- name: Check out repository code
uses: actions/checkout@v3
Expand All @@ -70,15 +97,16 @@ jobs:
- name: Log in to Docker Hub
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
username: ${{ secrets.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
registry: ${{ env.GHCR }}
username: ${{ github.actor }}
password: ${{ github.token }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.DOCKER_HUB_REPO }}
tags: ${GITHUB_REF_NAME}
images: ${{ env.GHCR }}/${{ env.DOCKER_IMAGE_NAME }}
tags: ${{ github.ref_name }}

- name: Build and publish docker image
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
Expand All @@ -88,14 +116,12 @@ jobs:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

build-save-docker:
if: github.ref_type == 'tag'

# Disable this job for now until repo is set
docker-hub-publish:
if: false
runs-on: ubuntu-20.04
needs: build-resources
permissions:
contents: write
packages: write
steps:
- name: Check out repository code
uses: actions/checkout@v3
Expand All @@ -105,11 +131,29 @@ jobs:
with:
name: docker-resource

- name: Build, save and release docker
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Prepare docker sources
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
- name: Log in to Docker Hub
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
username: ${{ secrets.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.DOCKER_IMAGE_NAME }}
tags: ${GITHUB_REF_NAME}

- name: Build and publish docker image
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

0 comments on commit 9a85f50

Please sign in to comment.