Skip to content

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

Merged
binarylogic merged 7 commits intomasterfrom
musl-unlimited
Jul 22, 2019
Merged

chore: build x86_64-unknown-linux-musl with all features#669
binarylogic merged 7 commits intomasterfrom
musl-unlimited

Conversation

@binarylogic
Copy link
Copy Markdown
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
Copy Markdown

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
Copy Markdown
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
Copy Markdown

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
Copy Markdown
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
Copy Markdown
Contributor Author

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

Comment thread distribution/docker/alpine/Dockerfile Outdated

FROM alpine:3.10.1

RUN apk add g++ gcc
Copy link
Copy Markdown

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
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done, thanks!

Comment thread distribution/docker/alpine/Dockerfile Outdated
RUN apk --no-cache add libgcc libstdc++

COPY --from=builder /release/bin/* /usr/local/bin/
COPY --from=builder /release/etc/vector /etc No newline at end of file
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

Comment thread docs/setup/installation/platforms/docker.md
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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