Skip to content

Commit

Permalink
Publish image on ghcr.io
Browse files Browse the repository at this point in the history
- pulls from dockerhub fail too often
  • Loading branch information
stephanme committed Jul 12, 2024
1 parent 9323704 commit e7bfc2f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ on:
- 'main'
tags:
- 'v*'

env:
REGISTRY: ghcr.io

jobs:

build:
Expand All @@ -21,7 +25,7 @@ jobs:
id: docker_meta
uses: docker/metadata-action@v5
with:
images: stephanme/modbus_exporter
images: ${{ env.REGISTRY }}/stephanme/modbus_exporter
tags: |
type=schedule
type=ref,event=pr
Expand All @@ -36,8 +40,9 @@ jobs:
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ Sample access with port forwarding:

## Build

The images are built and pushed to dockerhub by a github action.
The images are built and pushed to ghcr.io by a github action.

Manual local build:
```
docker build -t stephanme/modbus_exporter .
docker build -t ghcr.io/stephanme/modbus_exporter .
# full rebuild (update base image and chrome)
docker build --pull --no-cache -t stephanme/modbus_exporter .
docker build --pull --no-cache -t ghcr.io/stephanme/modbus_exporter .
```

## Release
Expand Down
2 changes: 1 addition & 1 deletion modbus-exporter-example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ spec:
spec:
containers:
- name: modbus-exporter
image: stephanme/modbus_exporter:latest
image: ghcr.io/stephanme/modbus_exporter:latest
ports:
- containerPort: 9602
command:
Expand Down

0 comments on commit e7bfc2f

Please sign in to comment.