-
Notifications
You must be signed in to change notification settings - Fork 823
Build image in github actions #6026
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
10 commits
Select commit
Hold shift + click to select a range
50ca766
Build image in github actions
friedrichg f4e936a
Bug fixes
friedrichg d1b3371
Target master
friedrichg 59fd8df
Fix save-multiarch-build-image
friedrichg 3905320
Include QEMU and buildx action
friedrichg 68786e6
Let's simplify and tests first
friedrichg 4588c16
test push
friedrichg 981368b
Push intermediate images
friedrichg 57d8005
Re-enable full build, update docs and make sure push is only possible…
friedrichg 5bb70c1
Fetch tags and use Makefile in build-image
friedrichg 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 |
---|---|---|
@@ -0,0 +1,68 @@ | ||
name: Build Image | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
paths: | ||
- 'build-image/**' | ||
- '.github/workflows/build-image.yml' | ||
pull_request: | ||
branches: [ master ] | ||
paths: | ||
- 'build-image/**' | ||
- '.github/workflows/build-image.yml' | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-24.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
name: Checkout | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Save image | ||
run: make save-multiarch-build-image | ||
|
||
- name: Upload Docker Images Artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: build-image | ||
path: | | ||
./build-image-amd64.tar | ||
./build-image-arm64.tar | ||
if-no-files-found: error | ||
|
||
push: | ||
needs: build | ||
if: (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')) && github.repository == 'cortexproject/cortex' | ||
runs-on: ubuntu-24.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
name: Checkout | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Download Docker Images Artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: build-image | ||
|
||
- name: Load image | ||
run: make load-multiarch-build-image | ||
|
||
- name: Login to Quay.io | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: quay.io | ||
username: ${{secrets.QUAY_REGISTRY_USER}} | ||
password: ${{secrets.QUAY_REGISTRY_PASSWORD}} | ||
|
||
- name: Push image | ||
run: make push-multiarch-build-image |
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 |
---|---|---|
|
@@ -27,3 +27,6 @@ Makefile.local | |
.vscode | ||
compose | ||
compose-simple | ||
|
||
/build-image-arm64.tar | ||
/build-image-amd64.tar |
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,17 @@ | ||
save-multiarch-build-image: | ||
@echo | ||
# Build image for each platform separately... it tends to generate fewer errors. | ||
$(SUDO) docker buildx build --platform linux/amd64 --build-arg=revision=$(GIT_REVISION) --build-arg=goproxyValue=$(GOPROXY_VALUE) -t $(IMAGE_PREFIX)build-image:$(IMAGE_TAG)-amd64 --output type=docker,dest=./build-image-amd64.tar build-image/ | ||
$(SUDO) docker buildx build --platform linux/arm64 --build-arg=revision=$(GIT_REVISION) --build-arg=goproxyValue=$(GOPROXY_VALUE) -t $(IMAGE_PREFIX)build-image:$(IMAGE_TAG)-arm64 --output type=docker,dest=./build-image-arm64.tar build-image/ | ||
|
||
load-multiarch-build-image: | ||
$(SUDO) docker load -i build-image-amd64.tar | ||
$(SUDO) docker load -i build-image-arm64.tar | ||
|
||
push-multiarch-build-image: | ||
# This command will run the same build as multiarch-build-image, but it will reuse existing platform-specific images, | ||
# put them together and push to registry. | ||
$(SUDO) docker push $(IMAGE_PREFIX)build-image:${IMAGE_TAG}-amd64 | ||
$(SUDO) docker push $(IMAGE_PREFIX)build-image:${IMAGE_TAG}-arm64 | ||
$(SUDO) docker manifest create $(IMAGE_PREFIX)build-image:$(IMAGE_TAG) --amend $(IMAGE_PREFIX)build-image:${IMAGE_TAG}-amd64 --amend $(IMAGE_PREFIX)build-image:${IMAGE_TAG}-arm64 | ||
$(SUDO) docker manifest push $(IMAGE_PREFIX)build-image:$(IMAGE_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
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.
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.
Extraneous "for" in second sentence.