Skip to content
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

Add github-action and Dockerfile for multi-arch build #207

Merged
merged 2 commits into from
Aug 19, 2021
Merged

Add github-action and Dockerfile for multi-arch build #207

merged 2 commits into from
Aug 19, 2021

Conversation

toelke
Copy link

@toelke toelke commented Aug 18, 2021

The need for this change has been discussed in piraeusdatastore/piraeus#74

This change is probably not extremely elegant; I saw that the operator-sdk-version used by this repository is quite old. I am circumventing it here by "manually" building the go-code during building the docker image.

I do not expect this to be merged like this, but I want to start a discussion...

@WanzenBug
Copy link
Member

On the whole, I'm not against removing operator-sdk from the build process. I think that's what happens in newer operator-sdk versions anyways. We are only using such an old versions because nobody has the time to upgrade.

operator-sdk doesn't actually do anything during the build, just calls go build. Ideally, we would just run go build with GOARCH=amd64 and once with GOARCH=arm64, and copy the artifact into gcr.io/distroless/static. I don't think we need anything from debian.

@toelke
Copy link
Author

toelke commented Aug 18, 2021

I am doing the first part of this using docker build containers -- that seemed easier for me :-|

I will look into putting the result into distroless and see what happens.

@toelke
Copy link
Author

toelke commented Aug 18, 2021

So running distroless (but not static) is working for both arm64 and amd64.

Copy link
Member

@WanzenBug WanzenBug left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good. I'd still like to try creating a distroless/static image and also removing:

  • the existing dockerfile + helper scripts
  • the existing github action that builds+pushes using operator-sdk

build/Dockerfile.multiarch Outdated Show resolved Hide resolved

.PHONY: update
update:
$(OPERATORSDKCMD) build --image-build-args "--no-cache=$(NOCACHE)" $(PROJECT):$(TAG)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't delete the whole makefile. Just replace this line with docker build -t $(PROJECT):$(TAG) --no-cache=$(NOCACHE) -f build/Dockerfile.multiarch .

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs to changed to -f build/Dockerfile now

build/Dockerfile.multiarch Outdated Show resolved Hide resolved
Signed-off-by: Philipp Riederer <priederer@tecracer.de>
@toelke
Copy link
Author

toelke commented Aug 19, 2021

About the failing pre-commit hook that checks for a correkt operator-sdk-setup: Should I remove the hook or should I rename the Dockerfile?

@WanzenBug
Copy link
Member

About the failing pre-commit hook that checks for a correkt operator-sdk-setup: Should I remove the hook or should I rename the Dockerfile?

Please rename the dockerfile, we still need a working operator-sdk for some things.

@toelke
Copy link
Author

toelke commented Aug 19, 2021

Thank you so much for your patience and all the good tips!

@WanzenBug
Copy link
Member

Almost ready to merge, just missing the one fix on the Makefile. Already gave it a test run, seems to be working without issue, and we have a smaller image too 👍

Signed-off-by: Philipp Riederer <priederer@tecracer.de>
@WanzenBug WanzenBug merged commit 6642f3e into piraeusdatastore:master Aug 19, 2021
@WanzenBug
Copy link
Member

🎉

@toelke toelke deleted the multi-arch-build branch August 19, 2021 13:52
@toelke
Copy link
Author

toelke commented Aug 19, 2021

Thanks again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants