https://github.com/kjuly/docker-image-publisher
Github Action to build and push tagged Docker image to a Registry.
https://github.com/kjuly/docker-image-publisher
build docker dockerhub github-action github-container-registry image publish
Last synced: 23 days ago
JSON representation
Github Action to build and push tagged Docker image to a Registry.
- Host: GitHub
- URL: https://github.com/kjuly/docker-image-publisher
- Owner: Kjuly
- License: mit
- Created: 2024-05-06T11:35:54.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2024-05-11T09:35:49.000Z (12 months ago)
- Last Synced: 2025-02-10T08:13:10.768Z (3 months ago)
- Topics: build, docker, dockerhub, github-action, github-container-registry, image, publish
- Homepage:
- Size: 9.77 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# docker-image-publisher
Github Action to build and push tagged Docker image to a Registry.## Usage
### Push to Docker Hub
```yaml
permissions:
contents: read
packages: write
id-token: write
attestations: writejobs:
build-n-push-image:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4- name: Build and Push Image to Docker Hub
uses: kjuly/docker-image-publisher@main
with:
image_name: user/image
username: ${{ secrets.DOCKERHUB_USERNAME }}
token: ${{ secrets.DOCKERHUB_TOKEN }}
```
The format of `image_name` is "user/image", which is optional here. If you don't provide one, `${{ github.repository }}` will by used.For `DOCKERHUB_USERNAME` & `DOCKERHUB_TOKEN`, go to the repository's "Settings > Security > Secrets and variables > Actions > Repository secrets" and add your Docker Hub username and token there.
See [Create and manage access tokens][create-n-manage-access-tokens] for the details about generating Docker Hub tokens.
---
### Push to Github Container Registry```yaml
...- name: Build and Push Image to Github Container Registry
uses: kjuly/docker-image-publisher@main
with:
registry: ghcr.io
image_name: ${{ env.IMAGE_NAME }}
username: ${{ github.actor }}
token: ${{ secrets.GITHUB_TOKEN }}
```[create-n-manage-access-tokens]: https://docs.docker.com/security/for-developers/access-tokens/