Skip to content

Commit 5316daa

Browse files
authored
Add GitHub Container Registry (#149)
Add the Docker image to the GitHub Container Registry as alternative to DockerHub and make GHCR the default in the Helm chart. This commit also adds the `cache-from` and `cache-to` parameters to the GitHub Action to build the Docker image.
1 parent 21f3a70 commit 5316daa

File tree

4 files changed

+17
-6
lines changed

4 files changed

+17
-6
lines changed

.github/workflows/continuous-delivery-docker.yaml

+12-1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@ jobs:
3838
username: ${{ secrets.DOCKER_USERNAME }}
3939
password: ${{ secrets.DOCKER_PASSWORD }}
4040

41+
- name: Login to GitHub Container Registry
42+
uses: docker/login-action@v3
43+
with:
44+
registry: ghcr.io
45+
username: ${{ github.actor }}
46+
password: ${{ secrets.GITHUB_TOKEN }}
47+
4148
- name: Build and Push Docker Image
4249
id: docker_build
4350
uses: docker/build-push-action@v6
@@ -46,4 +53,8 @@ jobs:
4653
context: .
4754
file: ./Dockerfile
4855
platforms: linux/386,linux/amd64,linux/arm/v7,linux/arm64/v8
49-
tags: ricoberger/script_exporter:${{ env.TAG }}
56+
cache-from: type=gha
57+
cache-to: type=gha,mode=max
58+
tags: |
59+
ghcr.io/${{ github.repository }}:${{ env.TAG }}
60+
ricoberger/script_exporter:${{ env.TAG }}

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ An example configuration can be found in the [examples](./examples) folder. To u
2121
To run the examples via Docker the following commands can be used:
2222

2323
```sh
24-
docker build -f ./Dockerfile -t ricoberger/script_exporter:dev .
25-
docker run --rm -it --name script_exporter -p 9469:9469 -v $(pwd)/examples:/examples ricoberger/script_exporter:dev -config.file /examples/config.yaml
24+
docker build -f ./Dockerfile -t ghcr.io/ricoberger/script_exporter:dev .
25+
docker run --rm -it --name script_exporter -p 9469:9469 -v $(pwd)/examples:/examples ghcr.io/ricoberger/script_exporter:dev -config.file /examples/config.yaml
2626
```
2727

2828
Then visit [http://localhost:9469](http://localhost:9469) in the browser of your choice. There you have access to the following examples:

charts/script-exporter/Chart.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ apiVersion: v2
22
name: script-exporter
33
description: Prometheus exporter to execute scripts and collect metrics from the output or the exit status.
44
type: application
5-
version: 0.8.7
6-
appVersion: v2.21.0
5+
version: 0.9.0
6+
appVersion: v2.22.0

charts/script-exporter/values.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ imagePullSecrets: []
1919
## Set the image which should be used for script_exporter.
2020
##
2121
image:
22-
repository: ricoberger/script_exporter
22+
repository: ghcr.io/ricoberger/script_exporter
2323
pullPolicy: IfNotPresent
2424
# Overrides the image tag whose default is the chart appVersion.
2525
tag: ""

0 commit comments

Comments
 (0)