https://github.com/pmorelli92/github-container-registry-build-push
Github Action that builds and pushes a docker image to Github Container Registry
https://github.com/pmorelli92/github-container-registry-build-push
Last synced: 4 months ago
JSON representation
Github Action that builds and pushes a docker image to Github Container Registry
- Host: GitHub
- URL: https://github.com/pmorelli92/github-container-registry-build-push
- Owner: pmorelli92
- License: mit
- Archived: true
- Created: 2021-01-16T14:56:50.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2023-12-05T16:53:24.000Z (over 1 year ago)
- Last Synced: 2024-04-23T19:24:11.196Z (12 months ago)
- Language: Shell
- Size: 8.79 KB
- Stars: 12
- Watchers: 3
- Forks: 9
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- jimsghstars - pmorelli92/github-container-registry-build-push - Github Action that builds and pushes a docker image to Github Container Registry (Shell)
README
## ARCHIVED
I recently started working again with Github Actions and given the fact that I needed to send build arguments and secrets to the Dockerfile I started to look at all the alternatives available as those are not supported in this repo.
I found that the `docker/build-push-action` works for pushing into the GHCR as well, so what was the biggest benefit of this action is now taken care somewhere else with more features and mainteinance. Therefore I suggest that you switch over to that one, I leave below a little snippet on how I used the action:
```
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io/my-org
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}- name: Build and push
uses: docker/build-push-action@v5
with:
push: true
tags: |
ghcr.io/my-org/my-svc:latest
ghcr.io/my-org/my-svc:some-tag
build-args: |
"x=y"
"foo=bar"
secrets: |
"secret-id=${{secrets.SECRET_VALUE}}"
```# GitHub Container Registry : Build and push
Github Action that builds and pushes a docker image to Github Container Registry.
## Example
```yaml
jobs:
build-svc:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
name: Checkout repository- uses: pmorelli92/[email protected]
name: Build and Publish latest service image
with:
github-push-secret: ${{secrets.GITHUB_TOKEN}}
docker-image-name: my-svc
docker-image-tag: latest # optional
dockerfile-path: Dockerfile # optional
build-context: . # optional
build-only: false # optional
docker-build-args: FOO=BAR,OTHER=VALUE # optional
```## Inspirations and acknowledgments
I heavily inspired on [gp-docker-action](https://github.com/VaultVulp/gp-docker-action) repository made by [Pavel Alimpiev](https://github.com/VaultVulp). This mentioned repo is pushing towards the *GitHub Packages Docker Registry* instead of the new *GitHub Container Registry*.
[More information on the new Github Container Registry here.](https://docs.github.com/en/packages/guides/migrating-to-github-container-registry-for-docker-images)