Skip to content

Commit

Permalink
unify all build files
Browse files Browse the repository at this point in the history
  • Loading branch information
sni committed Jan 25, 2025
1 parent 2dc0b15 commit 8d01a29
Show file tree
Hide file tree
Showing 3 changed files with 98 additions and 22 deletions.
58 changes: 48 additions & 10 deletions .github/workflows/latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ on:
- '*'
workflow_dispatch:

# set docker tag for all steps
env:
DOCKERTAG: latest

jobs:
docker_build:
name: docker
runs-on: ${{ matrix.target.runs }}
permissions:
packages: write
Expand Down Expand Up @@ -43,20 +46,55 @@ jobs:
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.PTA }}

- name: Build to hub.docker.com
- name: Build and Push
uses: docker/build-push-action@v6
with:
push: true
file: Dockerfile.omd-labs-${{ matrix.os }}
build-args: OMD_VERSION=${{ github.ref }}
tags: consol/omd-labs-${{ matrix.os }}:latest
tags: |
consol/omd-labs-${{ matrix.os }}:${{ env.DOCKERTAG }}-${{ matrix.target.platform }}
ghcr.io/consol/omd-labs-docker/omd-labs-${{ matrix.os }}:${{ env.DOCKERTAG }}-${{ matrix.target.platform }}
platforms: linux/${{ matrix.target.platform }}

- name: Build to ghcr.io
uses: docker/build-push-action@v6
manifest:
runs-on: ubuntu-24.04
needs: docker_build
permissions:
packages: write
contents: read
strategy:
fail-fast: false
matrix:
os:
- rocky
- debian
steps:
- uses: actions/checkout@v3

- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
push: true
file: Dockerfile.omd-labs-${{ matrix.os }}
build-args: OMD_VERSION=${{ github.ref }}
tags: ghcr.io/consol/omd-labs-docker/omd-labs-${{ matrix.os }}:latest
platforms: linux/${{ matrix.target.platform }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Log in to GitHub Docker Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.PTA }}

- name: push manifest to dockerhub
run: |
docker manifest create consol/omd-labs-${{ matrix.os }}:${{ env.DOCKERTAG }} \
consol/omd-labs-${{ matrix.os }}:${{ env.DOCKERTAG }}-amd64 \
consol/omd-labs-${{ matrix.os }}:${{ env.DOCKERTAG }}-arm64
docker manifest push consol/omd-labs-${{ matrix.os }}:${{ env.DOCKERTAG }}
- name: push manifest to github
run: |
docker manifest create ghcr.io/consol/omd-labs-docker/omd-labs-${{ matrix.os }}:${{ env.DOCKERTAG }} \
ghcr.io/consol/omd-labs-docker/omd-labs-${{ matrix.os }}:${{ env.DOCKERTAG }}-amd64 \
ghcr.io/consol/omd-labs-docker/omd-labs-${{ matrix.os }}:${{ env.DOCKERTAG }}-arm64
docker manifest push ghcr.io/consol/omd-labs-docker/omd-labs-${{ matrix.os }}:${{ env.DOCKERTAG }}
2 changes: 1 addition & 1 deletion .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,4 @@ jobs:
docker manifest create ghcr.io/consol/omd-labs-docker/omd-labs-${{ matrix.os }}:${{ env.DOCKERTAG }} \
ghcr.io/consol/omd-labs-docker/omd-labs-${{ matrix.os }}:${{ env.DOCKERTAG }}-amd64 \
ghcr.io/consol/omd-labs-docker/omd-labs-${{ matrix.os }}:${{ env.DOCKERTAG }}-arm64
docker manifest push ghcr.io/consol/omd-labs-docker/omd-labs-${{ matrix.os }}:${{ env.DOCKERTAG }}
docker manifest push ghcr.io/consol/omd-labs-docker/omd-labs-${{ matrix.os }}:${{ env.DOCKERTAG }}
60 changes: 49 additions & 11 deletions .github/workflows/releases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ on:
- '*'
workflow_dispatch:

# set docker tag for all steps
env:
DOCKERTAG: ${{ github.head_ref || github.ref_name }}

jobs:
docker_build:
name: docker
runs-on: ${{ matrix.target.runs }}
permissions:
packages: write
Expand Down Expand Up @@ -43,20 +46,55 @@ jobs:
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.PTA }}

- name: Build to hub.docker.com
- name: Build and Push
uses: docker/build-push-action@v6
with:
push: true
file: Dockerfile.omd-labs-${{ matrix.os }}
build-args: OMD_VERSION=${{ env.BRANCH_NAME }}
tags: consol/omd-labs-${{ matrix.os }}:${{ env.BRANCH_NAME }}
build-args: OMD_VERSION=${{ github.ref }}
tags: |
consol/omd-labs-${{ matrix.os }}:${{ env.DOCKERTAG }}-${{ matrix.target.platform }}
ghcr.io/consol/omd-labs-docker/omd-labs-${{ matrix.os }}:${{ env.DOCKERTAG }}-${{ matrix.target.platform }}
platforms: linux/${{ matrix.target.platform }}

- name: Build to ghcr.io
uses: docker/build-push-action@v6
manifest:
runs-on: ubuntu-24.04
needs: docker_build
permissions:
packages: write
contents: read
strategy:
fail-fast: false
matrix:
os:
- rocky
- debian
steps:
- uses: actions/checkout@v3

- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
push: true
file: Dockerfile.omd-labs-${{ matrix.os }}
build-args: OMD_VERSION=${{ github.ref }}
tags: ghcr.io/consol/omd-labs-docker/omd-labs-${{ matrix.os }}:${{ env.BRANCH_NAME }}
platforms: linux/${{ matrix.target.platform }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Log in to GitHub Docker Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.PTA }}

- name: push manifest to dockerhub
run: |
docker manifest create consol/omd-labs-${{ matrix.os }}:${{ env.DOCKERTAG }} \
consol/omd-labs-${{ matrix.os }}:${{ env.DOCKERTAG }}-amd64 \
consol/omd-labs-${{ matrix.os }}:${{ env.DOCKERTAG }}-arm64
docker manifest push consol/omd-labs-${{ matrix.os }}:${{ env.DOCKERTAG }}
- name: push manifest to github
run: |
docker manifest create ghcr.io/consol/omd-labs-docker/omd-labs-${{ matrix.os }}:${{ env.DOCKERTAG }} \
ghcr.io/consol/omd-labs-docker/omd-labs-${{ matrix.os }}:${{ env.DOCKERTAG }}-amd64 \
ghcr.io/consol/omd-labs-docker/omd-labs-${{ matrix.os }}:${{ env.DOCKERTAG }}-arm64
docker manifest push ghcr.io/consol/omd-labs-docker/omd-labs-${{ matrix.os }}:${{ env.DOCKERTAG }}

0 comments on commit 8d01a29

Please sign in to comment.