-
Notifications
You must be signed in to change notification settings - Fork 5
Build multiplatform docker images #172
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
2 commits
Select commit
Hold shift + click to select a range
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,18 +33,25 @@ jobs: | |
| runs-on: ubuntu-20.04 | ||
| steps: | ||
| - uses: actions/[email protected] | ||
| - name: Build kubernetes-tools image | ||
| run: make build-image BUILD_TAG=${{ inputs.build_tag }} | ||
| - name: Set up QEMU | ||
| uses: docker/[email protected] | ||
| - name: Set up Buildx | ||
| id: buildx | ||
| uses: docker/[email protected] | ||
| - name: Show Buildx platforms | ||
| run: echo ${{ steps.buildx.outputs.platforms }} | ||
| - name: Login to Docker Hub | ||
| uses: docker/[email protected] | ||
| with: | ||
| username: ${{ secrets.DOCKER_USERNAME }} | ||
| password: ${{ secrets.DOCKER_PASSWORD }} | ||
| - name: Push kubernetes-tools image to Docker Hub | ||
| run: make push-image BUILD_TAG=${{ inputs.build_tag }} | ||
| - name: Push kubernetes-tools image build cache to Docker Hub | ||
| # only push cache to Dockerhub as ECR doesn't support it yet | ||
| # https://github.com/aws/containers-roadmap/issues/876 | ||
| - name: Build and push image build cache to Docker Hub | ||
| if: ${{ inputs.push_cache }} | ||
| run: make push-image-cache BUILD_TAG=${{ inputs.build_tag }} | ||
| run: make push-image-cache | ||
| - name: Build and push image to Docker Hub | ||
| run: make push-image BUILD_TAG=${{ inputs.build_tag }} | ||
| - name: Tag latest to point to most recent release in Docker Hub | ||
| if: ${{ inputs.tag_latest }} | ||
| run: make tag-release-image-with-latest BUILD_TAG=${{ inputs.build_tag }} | ||
|
|
@@ -55,9 +62,6 @@ jobs: | |
| AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
| - name: Build and push image to ECR | ||
| run: make push-image-ecr BUILD_TAG=${{ inputs.build_tag }} | ||
| - name: Push kubernetes-tools image build cache to ECR | ||
| if: ${{ inputs.push_cache }} | ||
| run: make push-image-cache-ecr BUILD_TAG=${{ inputs.build_tag }} | ||
| - name: Tag latest to point to most recent release in ECR | ||
| if: ${{ inputs.tag_latest }} | ||
| run: make tag-release-image-with-latest-ecr BUILD_TAG=${{ inputs.build_tag }} | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| variable "IMAGE" { | ||
| default = "kubernetes-tools" | ||
| } | ||
|
|
||
| variable "TAG" { | ||
| default = "dev-latest" | ||
| } | ||
|
|
||
| variable "CACHE_IMAGE" { | ||
| default = "sumologic/kubernetes-tools" | ||
| } | ||
|
|
||
| variable "BUILD_GO_CACHE_TAG" { | ||
| default = "go-build-cache" | ||
| } | ||
|
|
||
| variable "BUILD_RUST_CACHE_TAG" { | ||
| default = "rust-build-cache" | ||
| } | ||
|
|
||
| variable "TOOLS_CACHE_TAG" { | ||
| default = "tools-build-cache" | ||
| } | ||
|
|
||
| target "multiplatform" { | ||
| platforms = ["linux/amd64", "linux/arm64"] | ||
| output = ["type=image"] | ||
| } | ||
|
|
||
| target "default" { | ||
| dockerfile = "Dockerfile" | ||
| tags = ["${IMAGE}:${TAG}"] | ||
| cache-from = [ | ||
| "${CACHE_IMAGE}:${BUILD_GO_CACHE_TAG}", | ||
| "${CACHE_IMAGE}:${BUILD_RUST_CACHE_TAG}", | ||
| "${CACHE_IMAGE}:${TOOLS_CACHE_TAG}", | ||
| ] | ||
| output = ["type=docker"] | ||
| platforms = ["linux/amd64"] | ||
| } | ||
|
|
||
| target "tools-multiplatform" { | ||
| inherits = ["default", "multiplatform"] | ||
| } | ||
|
|
||
| group "cache" { | ||
| targets = ["rust-cache", "go-cache", "tools-cache"] | ||
| } | ||
|
|
||
| target "rust-cache" { | ||
| dockerfile = "Dockerfile" | ||
| cache-from = [ | ||
| "${CACHE_IMAGE}:${BUILD_RUST_CACHE_TAG}", | ||
| ] | ||
| cache-to = ["${CACHE_IMAGE}:${BUILD_RUST_CACHE_TAG}"] | ||
| target = "rust-builder" | ||
| } | ||
|
|
||
| target "go-cache" { | ||
| dockerfile = "Dockerfile" | ||
| cache-from = [ | ||
| "${CACHE_IMAGE}:${BUILD_GO_CACHE_TAG}", | ||
| ] | ||
| cache-to = ["${CACHE_IMAGE}:${BUILD_GO_CACHE_TAG}"] | ||
| target = "go-builder" | ||
| } | ||
|
|
||
| target "tools-cache" { | ||
| inherits = ["default"] | ||
| cache-to = ["${CACHE_IMAGE}:${TOOLS_CACHE_TAG}"] | ||
| } | ||
|
|
||
| group "cache-multiplatform" { | ||
| targets = ["rust-cache-multiplatform", "go-cache-multiplatform", "tools-cache-multiplatform"] | ||
| } | ||
|
|
||
| target "rust-cache-multiplatform" { | ||
| inherits = ["rust-cache", "multiplatform"] | ||
| } | ||
|
|
||
| target "go-cache-multiplatform" { | ||
| inherits = ["go-cache", "multiplatform"] | ||
| } | ||
|
|
||
| target "tools-cache-multiplatform" { | ||
| inherits = ["tools-cache", "multiplatform"] | ||
| } |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like a nice feature 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a bit more text in the
docker-bake.hclfile than the shell commands it replaced, but I like the separation of concerns.