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

Allow cross building kafka for various archs #257

Closed
wants to merge 2 commits into from

Conversation

sudswas
Copy link

@sudswas sudswas commented Jan 30, 2018

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.

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.

RUN apk add --update unzip wget curl docker jq coreutils \
&& chmod a+x /tmp/*.sh \
RUN mkdir -p /opt

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 RUNs could benefit from being a single RUN, i.e. one layer less.

Copy link
Author

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.

&& 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 \

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?

Copy link
Author

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)

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)?

Copy link
Author

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?

@sudswas
Copy link
Author

sudswas commented Jan 30, 2018

@jaceklaskowski thanks for the quick review. I have updated the changes per your review comments. Let me know your thoughts!

@jaceklaskowski
Copy link

LGTM

@sudswas
Copy link
Author

sudswas commented Feb 2, 2018

@wurstmeister Hi, could you please review this PR? Thanks!

@sscaling
Copy link
Collaborator

sscaling commented Mar 5, 2018

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.

@wurstmeister
Copy link
Owner

multi arch support added in #694

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.

4 participants