Skip to content

chore: build x86_64-unknown-linux-musl with all features #669

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 7 commits into from
Jul 22, 2019

Conversation

binarylogic
Copy link
Contributor

@binarylogic binarylogic commented Jul 21, 2019

@a-rodin demonstrated a full build on Alpine linux (#661 (comment)) which allows us to release a full build for target x86_64-unknown-linux-musl without limited features. This change updates our release process for that target to follow that example.

Ref #661, #630, #654

@binarylogic binarylogic requested a review from LucioFranco July 21, 2019 13:14
@binarylogic binarylogic force-pushed the musl-unlimited branch 2 times, most recently from 3265981 to b0e1a8e Compare July 21, 2019 13:19
@ghost
Copy link

ghost commented Jul 21, 2019

Note that the resulting binary is not fully static, as it is linked dynamically to both musl and libstdc++.

It means that it can be used to create an Alpine-based Docker image, but not a stand-alone binary that can be distributed separately.

I think this repo looks like a promising base to build fully static binary, I'm actually going to try it out and report the results later.

@binarylogic
Copy link
Contributor Author

Ah got it. Yeah, this is definitely not my area of expertise. I'll see if I can adjust this for the Alpine image only.

@ghost
Copy link

ghost commented Jul 21, 2019

I'll try to create a PR that would build an Alpine image without dev dependencies using multi-stage builds.

@binarylogic
Copy link
Contributor Author

Sure, I was just going to update this Dockerfile and do exactly what you said with the multi-stage build.

@binarylogic
Copy link
Contributor Author

I updated the alpine Docker image to follow your example. You'll notice here we still require g++ and gcc.

FROM alpine:3.10.1

RUN apk add g++ gcc
Copy link

Choose a reason for hiding this comment

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

Here libgcc and libstd++ can be be used, so the command can be like

RUN apk --no-cache add libgcc libstdc++

to keep to container smaller.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, thanks!


COPY --from=builder /release/bin/* /usr/local/bin/
COPY --from=builder /release/etc/vector /etc
Copy link
Contributor

Choose a reason for hiding this comment

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

is this missing an entrypoint?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What is proper Docker etiquette here?

Copy link
Contributor

Choose a reason for hiding this comment

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

if this is a container someone might use to run vector then you want the entry point to be the binary. Check below.

https://github.com/timberio/vector/blob/434bed8bce6d78517d9d8c07240305df0512ec27/Dockerfile#L40

Copy link
Contributor

@LucioFranco LucioFranco left a comment

Choose a reason for hiding this comment

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

@binarylogic I think if we can add the entrypoint back then its a +1 from me.

RUN apk --no-cache add libgcc libstdc++

COPY --from=builder /release/bin/* /usr/local/bin/
Copy link
Contributor

Choose a reason for hiding this comment

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

why are we copying this folder? I think at a min we should only copy what we need?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That folder is designed to hold any binaries we want to ship, which currently is only vector. I thought it was more future proof to do it this way.

Signed-off-by: Ben Johnson <[email protected]>
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.

2 participants