3 Commits

Author SHA1 Message Date
f19896ce3b Enable login to GitHub Container Registry and set push to true in Docker build workflow
Some checks failed
Build and Push Loki Database / build-and-push (push) Failing after 24s
2026-01-20 10:21:15 +01:00
45d0ffe3bb Add optional registry inputs to Docker build workflow for flexibility
All checks were successful
Build and Push Loki Database / build-and-push (push) Successful in 16s
2026-01-20 10:17:51 +01:00
6efe762f49 Enable Docker build and push step in action-build-and-push.yaml with push set to false
All checks were successful
Build and Push Loki Database / build-and-push (push) Successful in 1m10s
2026-01-20 10:11:20 +01:00
2 changed files with 45 additions and 17 deletions

View File

@@ -34,6 +34,30 @@ on:
Comma-separated list of target platforms to build.
Example: linux/amd64,linux/arm64
registry:
type: string
required: false
default: ghcr.io
description: >
Container registry to push the image to.
Example: ghcr.io or docker.io
registry_username:
type: string
required: false
default: ${{ github.repository_owner }}
description: >
Username for the container registry.
Example: myusername
registry_password:
type: string
required: false
default: ${{ secrets.GITHUB_TOKEN }}
description: >
Password or token for the container registry.
Example: secrets.GITHUB_TOKEN
jobs:
build-and-push:
runs-on: ubuntu-latest
@@ -61,25 +85,25 @@ jobs:
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ steps.lowercase.outputs.username }}/${{ inputs.image_name }}
images: ${{ inputs.registry }}/${{ steps.lowercase.outputs.username }}/${{ inputs.image_name }}
tags: |
type=match,pattern=.*(v\d+\.\d+\.\d+),group=1
type=match,pattern=.*(v\d+\.\d+)\.\d+,group=1
type=match,pattern=.*(v\d+)\.\d+\.\d+,group=1
# - name: Login to GitHub Container Registry
# uses: docker/login-action@v3
# with:
# registry: ghcr.io
# username: ${{ github.repository_owner }}
# password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ inputs.registry }}
username: ${{ inputs.registry_username }}
password: ${{ inputs.registry_password }}
# - name: Build and push
# uses: docker/build-push-action@v6
# with:
# context: ${{ inputs.build_context }}
# file: ${{ inputs.file_path }}
# platforms: ${{ inputs.platforms }}
# push: true
# tags: ${{ steps.meta.outputs.tags }}
# labels: ${{ steps.meta.outputs.labels }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: ${{ inputs.build_context }}
file: ${{ inputs.file_path }}
platforms: ${{ inputs.platforms }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

View File

@@ -14,4 +14,8 @@ jobs:
with:
image_name: observability/loki
build_context: ./observability/loki
file_path: ./observability/loki/Dockerfile
file_path: ./observability/loki/Dockerfile
registry: gitea.obnitram.cloud
registry_username: ${{ github.repository_owner }}
registry_password: ${{ secrets.GITEA_TOKEN }}