-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Allow cross building kafka for various archs #257
Conversation
This commit introduces a way by which we can now build multi-arch docker images of kakfa. This patch provides an initial framework based on some inspiration from: https://github.com/kubernetes/kubernetes/tree/master/build/debian-base This patch will allow you to build a cross platform image on an amd64 machine. Usage: `make build` ==> Retains the old behavior of builds `make build ARCH=ppc64le` ==> Builds it for a specific arch We can further include s390x and arm as other platforms. Further we can use the manifest-tool or the latest docker client to push manifest images to dockerhub.
Dockerfile.crossbuild
Outdated
|
||
RUN apk add --update unzip wget curl docker jq coreutils \ | ||
&& chmod a+x /tmp/*.sh \ | ||
RUN mkdir -p /opt |
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.
I think this and the following RUN
s could benefit from being a single RUN
, i.e. one layer less.
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.
Will fix in the next patch. Thanks for the comment.
Dockerfile.crossbuild
Outdated
&& chmod a+x /tmp/*.sh \ | ||
RUN mkdir -p /opt | ||
RUN apk add --update unzip wget curl docker jq coreutils bash \ | ||
&& chmod a+x /tmp/*.sh && sync \ |
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.
Where does this sync
come from?
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.
Without this sync
- I was seeing this issue : #138
So i forward ported the fix that's presently here: https://github.com/wurstmeister/kafka-docker/blob/0.10.0/Dockerfile#L12
Makefile
Outdated
| sed "/CROSS_BUILD_COPY/d" \ | ||
> $(TEMP_DIR)/Dockerfile.crossbuild | ||
# We just build it using the usual process. | ||
docker build -t $(BUILD_IMAGE) -f $(TEMP_DIR)/Dockerfile.crossbuild $(TEMP_DIR) |
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.
How about replacing crossbuild
with ARCH
(since it's no longer crossbuild)?
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.
Are you suggesting changing the name of the file?
Ideally I kept one file to avoid any out of sync issues across ARCHs.
Another way could be that I write > $(TEMP_DIR)/Dockerfile.ARCH
instead of >$(TEMP_DIR)/Dockerfile.crossbuild
and then build using that file. Thoughts?
@jaceklaskowski thanks for the quick review. I have updated the changes per your review comments. Let me know your thoughts! |
LGTM |
@wurstmeister Hi, could you please review this PR? Thanks! |
Hi @sudswas - could you provide some more context to what problem this is solving, along with relevant use-cases and proposed build strategy? Currently images are built on Docker hub, which is relying on the Dockerfile being present. |
multi arch support added in #694 |
This commit introduces a way by which we can now build multi-arch
docker images of kakfa. This patch provides an initial framework
based on some inspiration from:
https://github.com/kubernetes/kubernetes/tree/master/build/debian-base
This patch will allow you to build a cross platform image on an
amd64 machine.
Usage:
We can further include s390x and arm as other platforms.
Further we can use the manifest-tool or the latest docker client
to push manifest images to dockerhub.