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

Only build Windows binary on supported platforms #75

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 14 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,15 @@ COPY go-controller/ .

# build the binaries
RUN CGO_ENABLED=0 make
RUN CGO_ENABLED=0 make windows

# only build windows on supported platforms
# otherwise create a dummy windows binary to allow subsequent COPY to still work
RUN if [[ $(arch) =~ ^(x86_64|i386)$ ]]; then \
Copy link
Contributor

Choose a reason for hiding this comment

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

ugh... this is really ugly and I don't have any good suggestion on how to improve it, except that maybe this means we should not be building the windows binary here (since we don't actually need it to be in this image anyway and are only doing that as a hack).

@dcbw?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

there is a PR to move it into its own image: #68

CGO_ENABLED=0 make windows; \
else \
mkdir -p /go-controller/_output/go/bin/windows/ && \
touch /go-controller/_output/go/bin/windows/hybrid-overlay-noop; \
fi

FROM openshift/origin-cli AS cli

Expand Down Expand Up @@ -52,7 +60,11 @@ RUN mkdir -p /var/run/openvswitch && \
COPY --from=builder /go-controller/_output/go/bin/ovnkube /usr/bin/
COPY --from=builder /go-controller/_output/go/bin/ovn-kube-util /usr/bin/
COPY --from=builder /go-controller/_output/go/bin/ovn-k8s-cni-overlay /usr/libexec/cni/ovn-k8s-cni-overlay
COPY --from=builder /go-controller/_output/go/bin/windows/hybrid-overlay /root/windows/
COPY --from=builder /go-controller/_output/go/bin/windows/hybrid-overlay* /root/windows/

RUN if [[ ! $(arch) =~ ^(x86_64|i386)$ ]]; then \
rm -rf /root/windows; \
fi

COPY --from=cli /usr/bin/oc /usr/bin/
RUN ln -s /usr/bin/oc /usr/bin/kubectl
Expand Down