-
Notifications
You must be signed in to change notification settings - Fork 0
GHA Docker image building setup #17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
e24ad72
Derive roxie version from git tags, use that version as docker tag
5067cda
GHA: Docker image building job
704a8a8
Updated README with current docker related information
4cdef1a
Added Makefile to dockerignore
66739ff
Dockerfile: Set KUBECONFIG in env
7e8b889
Add dummy 'localhost' repo for image to be built.
d948f1c
Makefile: Removed a couple of DOCKER_ variable naming. Streamline set…
55f7aa7
GHA setup: address feedback.
1a63cea
Bump go version go.mod
15f18bc
Makefile targets for build date and commit hash
9e8d165
Dockerfile: bump to golang 1.25
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,6 +33,7 @@ vendor/ | |
| tests/ | ||
|
|
||
| # Configuration | ||
| Makefile | ||
| .envrc | ||
| *.yaml | ||
| *.yml | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| name: Docker Build and Push | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ main ] | ||
| tags: | ||
| - 'v*' | ||
| pull_request: | ||
| branches: [ main ] | ||
|
|
||
| env: | ||
| REGISTRY: ghcr.io | ||
|
tommartensen marked this conversation as resolved.
|
||
| IMAGE_NAME: ${{ github.repository }} | ||
|
|
||
| jobs: | ||
| docker-build-push: | ||
| name: Build and Push Multi-arch Image | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| packages: write | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Set up Go | ||
| uses: actions/setup-go@v6 | ||
| with: | ||
| go-version-file: go.mod | ||
| cache: true | ||
|
|
||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
|
|
||
| - name: Log in to GitHub Container Registry | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| registry: ${{ env.REGISTRY }} | ||
| username: ${{ github.actor }} | ||
| password: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Get build metadata | ||
| id: build-meta | ||
| run: | | ||
| echo "version=$(make version)" >> $GITHUB_OUTPUT | ||
| echo "git_commit=$(make get-commit-hash)" >> $GITHUB_OUTPUT | ||
| echo "build_date=$(make get-build-date)" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Extract metadata (tags, labels) for Docker | ||
| id: meta | ||
| uses: docker/metadata-action@v5 | ||
| with: | ||
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
| tags: | | ||
| # Tag with 'latest' for main branch. | ||
| type=raw,value=latest,enable={{is_default_branch}} | ||
| # Tag with version string from 'make version'. | ||
| type=raw,value=${{ steps.build-meta.outputs.version }} | ||
|
|
||
| - name: Build and push Docker image | ||
| id: docker_build | ||
| uses: docker/build-push-action@v6 | ||
| with: | ||
| context: . | ||
| platforms: linux/amd64,linux/arm64 | ||
|
mclasmeier marked this conversation as resolved.
|
||
| push: true | ||
| tags: ${{ steps.meta.outputs.tags }} | ||
| labels: ${{ steps.meta.outputs.labels }} | ||
| build-args: | | ||
| VERSION=${{ steps.build-meta.outputs.version }} | ||
| GIT_COMMIT=${{ steps.build-meta.outputs.git_commit }} | ||
| BUILD_DATE=${{ steps.build-meta.outputs.build_date }} | ||
| cache-from: | | ||
| type=gha | ||
| type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache | ||
| cache-to: type=gha,mode=max | ||
|
|
||
| - name: Image digest | ||
| run: echo "Image pushed with digest ${{ steps.docker_build.outputs.digest }}" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.