Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tob1as committed Nov 11, 2023
1 parent ff2d818 commit 5fda96a
Show file tree
Hide file tree
Showing 4 changed files with 413 additions and 0 deletions.
101 changes: 101 additions & 0 deletions .github/workflows/build_docker_images-mqtt-forwarder.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: 'build docker images: mqtt-forwarder'

on:
#push:
# branches:
# - 'main'
# - 'master'
# paths:
# - 'mqtt-forwarder.scratch.Dockerfile'
# - '.github/workflows/build_docker_images-mqtt-forwarder.yaml'
workflow_dispatch:
schedule:
- cron: '30 6 28 * *' # At 06:30 on day-of-month 28.

defaults:
run:
shell: bash

jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Shell-Script
id: script
run: |
BUILD_DATE="$(date -u +'%Y-%m-%dT%H:%M:%SZ')"
BUILD_DATE_NUMERIC="${BUILD_DATE//[^[:digit:]]/}"
COMMIT_HASH=${GITHUB_SHA::8}
GITHUB_REPO=${GITHUB_REPOSITORY,,}
GITHUB_REPO_SHORT=${GITHUB_REPO#*/}
GITHUB_REPO_SHORT=${GITHUB_REPO_SHORT#"docker-"}
DOCKER_REPO=${{ secrets.DOCKER_USERNAME }}/${GITHUB_REPO_SHORT}
REDHAT_QUAY_REPO=${{ secrets.REDHAT_QUAY_USERNAME }}/${GITHUB_REPO_SHORT}
# Set output parameters to github action.
echo ::set-output name=build_date::${BUILD_DATE}
echo ::set-output name=build_date_numeric::${BUILD_DATE_NUMERIC}
echo ::set-output name=commit_hash::${COMMIT_HASH}
echo ::set-output name=github_repo::${GITHUB_REPO}
echo ::set-output name=docker_repo::${DOCKER_REPO}
echo ::set-output name=redhat_quay_repo::${REDHAT_QUAY_REPO}
- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v2
with:
image: tonistiigi/binfmt:latest
platforms: all

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Login to DockerHub
uses: docker/login-action@v2
with:
registry: docker.io
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Login to RED HAT Quay.io Container Registry
uses: docker/login-action@v2
with:
registry: quay.io
username: ${{ secrets.REDHAT_QUAY_USERNAME }}
password: ${{ secrets.REDHAT_QUAY_PASSWORD }}

- name: Build
uses: docker/build-push-action@v3
with:
builder: ${{ steps.buildx.outputs.name }}
context: .
file: ./mqtt-forwarder.scratch.Dockerfile
platforms: linux/amd64,linux/arm64/v8,linux/arm/v7,linux/arm/v6
push: true
build-args: |
BUILD_DATE=${{steps.script.outputs.build_date}}
VCS_REF=${{steps.script.outputs.commit_hash}}
tags: |
docker.io/${{steps.script.outputs.docker_repo}}:mqtt-forwarder
quay.io/${{steps.script.outputs.redhat_quay_repo}}:mqtt-forwarder
ghcr.io/${{steps.script.outputs.github_repo}}:mqtt-forwarder
#- name: Docker Hub Description
# uses: peter-evans/dockerhub-description@v3
# with:
# username: ${{ secrets.DOCKER_USERNAME }}
# password: ${{ secrets.DOCKER_PASSWORD }}
# repository: ${{steps.script.outputs.docker_repo}}
# short-description: ${{ github.event.repository.description }}
# readme-filepath: README.md
110 changes: 110 additions & 0 deletions .github/workflows/build_docker_images-postgres-exporter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
name: 'build docker images: postgres-exporter'

on:
#push:
# branches:
# - 'main'
# - 'master'
# paths:
# - 'postgres-exporter.scratch.Dockerfile'
# - '.github/workflows/build_docker_images-postgres-exporter.yaml'
workflow_dispatch:
schedule:
- cron: '30 5 26 * *' # At 05:30 on day-of-month 26.

defaults:
run:
shell: bash

jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Shell-Script
id: script
run: |
BUILD_DATE="$(date -u +'%Y-%m-%dT%H:%M:%SZ')"
BUILD_DATE_NUMERIC="${BUILD_DATE//[^[:digit:]]/}"
COMMIT_HASH=${GITHUB_SHA::8}
GITHUB_REPO=${GITHUB_REPOSITORY,,}
GITHUB_REPO_SHORT=${GITHUB_REPO#*/}
GITHUB_REPO_SHORT=${GITHUB_REPO_SHORT#"docker-"}
DOCKER_REPO=${{ secrets.DOCKER_USERNAME }}/${GITHUB_REPO_SHORT}
REDHAT_QUAY_REPO=${{ secrets.REDHAT_QUAY_USERNAME }}/${GITHUB_REPO_SHORT}
# postgres-exporter
POSTGRES_EXPORTER_VERSION=$(wget -qO- https://api.github.com/repos/prometheus-community/postgres_exporter/releases/latest | grep 'tag_name' | cut -d\" -f4 | head -1)
echo "POSTGRES_EXPORTER_VERSION=${POSTGRES_EXPORTER_VERSION}"
# Set output parameters to github action.
echo ::set-output name=build_date::${BUILD_DATE}
echo ::set-output name=build_date_numeric::${BUILD_DATE_NUMERIC}
echo ::set-output name=commit_hash::${COMMIT_HASH}
echo ::set-output name=github_repo::${GITHUB_REPO}
echo ::set-output name=docker_repo::${DOCKER_REPO}
echo ::set-output name=redhat_quay_repo::${REDHAT_QUAY_REPO}
# postgres-exporter
echo ::set-output name=postgres_exporter_version::${POSTGRES_EXPORTER_VERSION}
- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v2
with:
image: tonistiigi/binfmt:latest
platforms: all

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Login to DockerHub
uses: docker/login-action@v2
with:
registry: docker.io
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Login to RED HAT Quay.io Container Registry
uses: docker/login-action@v2
with:
registry: quay.io
username: ${{ secrets.REDHAT_QUAY_USERNAME }}
password: ${{ secrets.REDHAT_QUAY_PASSWORD }}

- name: Build
uses: docker/build-push-action@v3
with:
builder: ${{ steps.buildx.outputs.name }}
context: .
file: ./postgres-exporter.scratch.Dockerfile
platforms: linux/amd64,linux/arm64/v8,linux/arm/v7,linux/arm/v6
push: true
build-args: |
BUILD_DATE=${{steps.script.outputs.build_date}}
VCS_REF=${{steps.script.outputs.commit_hash}}
VERSION=${{steps.script.outputs.postgres_exporter_version}}
tags: |
docker.io/${{steps.script.outputs.docker_repo}}:postgres-exporter
docker.io/${{steps.script.outputs.docker_repo}}:postgres-exporter-${{steps.script.outputs.postgres_exporter_version}}
quay.io/${{steps.script.outputs.redhat_quay_repo}}:postgres-exporter
ghcr.io/${{steps.script.outputs.github_repo}}:postgres-exporter
#- name: Docker Hub Description
# uses: peter-evans/dockerhub-description@v3
# with:
# username: ${{ secrets.DOCKER_USERNAME }}
# password: ${{ secrets.DOCKER_PASSWORD }}
# repository: ${{steps.script.outputs.docker_repo}}
# short-description: ${{ github.event.repository.description }}
# readme-filepath: README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: 'build docker images: prometheus-mosquitto-exporter'

on:
#push:
# branches:
# - 'main'
# - 'master'
# paths:
# - 'prometheus-mosquitto-exporter.debian.Dockerfile'
# - '.github/workflows/build_docker_images-prometheus-mosquitto-exporter.yaml'
workflow_dispatch:
schedule:
- cron: '30 6 25 * *' # At 06:30 on day-of-month 25.

defaults:
run:
shell: bash

jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Shell-Script
id: script
run: |
BUILD_DATE="$(date -u +'%Y-%m-%dT%H:%M:%SZ')"
BUILD_DATE_NUMERIC="${BUILD_DATE//[^[:digit:]]/}"
COMMIT_HASH=${GITHUB_SHA::8}
GITHUB_REPO=${GITHUB_REPOSITORY,,}
GITHUB_REPO_SHORT=${GITHUB_REPO#*/}
GITHUB_REPO_SHORT=${GITHUB_REPO_SHORT#"docker-"}
DOCKER_REPO=${{ secrets.DOCKER_USERNAME }}/${GITHUB_REPO_SHORT}
REDHAT_QUAY_REPO=${{ secrets.REDHAT_QUAY_USERNAME }}/${GITHUB_REPO_SHORT}
# Set output parameters to github action.
echo ::set-output name=build_date::${BUILD_DATE}
echo ::set-output name=build_date_numeric::${BUILD_DATE_NUMERIC}
echo ::set-output name=commit_hash::${COMMIT_HASH}
echo ::set-output name=github_repo::${GITHUB_REPO}
echo ::set-output name=docker_repo::${DOCKER_REPO}
echo ::set-output name=redhat_quay_repo::${REDHAT_QUAY_REPO}
- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v2
with:
image: tonistiigi/binfmt:latest
platforms: all

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Login to DockerHub
uses: docker/login-action@v2
with:
registry: docker.io
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Login to RED HAT Quay.io Container Registry
uses: docker/login-action@v2
with:
registry: quay.io
username: ${{ secrets.REDHAT_QUAY_USERNAME }}
password: ${{ secrets.REDHAT_QUAY_PASSWORD }}

- name: Build
uses: docker/build-push-action@v3
with:
builder: ${{ steps.buildx.outputs.name }}
context: .
file: ./prometheus-mosquitto-exporter.debian.Dockerfile
platforms: linux/amd64,linux/arm64/v8,linux/arm/v7
push: true
build-args: |
BUILD_DATE=${{steps.script.outputs.build_date}}
VCS_REF=${{steps.script.outputs.commit_hash}}
tags: |
docker.io/${{steps.script.outputs.docker_repo}}:prometheus-mosquitto-exporter
quay.io/${{steps.script.outputs.redhat_quay_repo}}:prometheus-mosquitto-exporter
ghcr.io/${{steps.script.outputs.github_repo}}:prometheus-mosquitto-exporter
#- name: Docker Hub Description
# uses: peter-evans/dockerhub-description@v3
# with:
# username: ${{ secrets.DOCKER_USERNAME }}
# password: ${{ secrets.DOCKER_PASSWORD }}
# repository: ${{steps.script.outputs.docker_repo}}
# short-description: ${{ github.event.repository.description }}
# readme-filepath: README.md
Loading

0 comments on commit 5fda96a

Please sign in to comment.