-
-
Notifications
You must be signed in to change notification settings - Fork 3
feat: musl build #21
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
Open
Open
feat: musl build #21
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
4fb0230
feat: musl build
akvlad dffb9f5
Merge remote-tracking branch 'origin/main' into dep_replace
akvlad cc2fac4
feat: test build
akvlad 01b7cab
feat: test build
akvlad 078b9f7
fix: test build
akvlad ff62b23
Merge branch 'main' into dep_replace
lmangani File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,58 +15,10 @@ jobs: | |
| steps: | ||
| - uses: actions/checkout@v3 | ||
|
|
||
| - name: Set up Rust | ||
| uses: actions-rs/toolchain@v1.0.6 | ||
| with: | ||
| toolchain: stable | ||
| override: true | ||
| components: rustfmt, clippy | ||
| - name: Set up Go | ||
| uses: actions/setup-go@v3 | ||
| with: | ||
| go-version: 1.18 | ||
|
|
||
| - name: Cache Flux Build | ||
| id: cacheflux | ||
| uses: actions/cache@v3.0.11 | ||
| with: | ||
| path: | | ||
| flux | ||
| ~/.cache/go-build | ||
| ~/go/pkg/mod | ||
| key: ${{ runner.os }}-fluxpipe-${{ hashFiles('**/fluxpipe-server.go') }} | ||
|
|
||
| - name: Cache Status | ||
| run: | | ||
| echo ${{steps.cacheflux.outputs.cache-hit}} | ||
|
|
||
| - name: Get Flux | ||
| if: steps.cacheflux.outputs.cache-hit != 'true' | ||
| uses: GuillaumeFalourd/clone-github-repo-action@v2 | ||
| with: | ||
| owner: 'InfluxCommunity' | ||
| repository: 'flux' | ||
|
|
||
| - name: Compile Flux | ||
| if: steps.cacheflux.outputs.cache-hit != 'true' | ||
| run: | | ||
| cd flux | ||
| go mod tidy | ||
| go get ./... | ||
| make | ||
|
|
||
| - name: Build Fluxpipe | ||
| run: | | ||
| sed -i 's:/usr/src:'`pwd`':' flux.pc | ||
| ./build.sh | ||
|
|
||
| - name: Compress Fluxpipe | ||
| run: | | ||
| strip fluxpipe-server | ||
| strip fluxpipe-lambda | ||
| strip fluxpipelib.a | ||
| upx fluxpipe-server | ||
| run: docker build --target export -t test . -f Dockerfile_musl --output out | ||
|
|
||
|
|
||
| - name: Get Timestamp | ||
| if: github.event_name != 'pull_request' | ||
| id: time | ||
|
|
@@ -86,9 +38,9 @@ jobs: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| with: | ||
| release_config: | | ||
| fluxpipe-server | ||
| fluxpipe-lambda | ||
| fluxpipelib.a | ||
| out/fluxpipe-server | ||
| out/fluxpipe-lambda | ||
| out/fluxpipelib.a | ||
| tag_name: ${{ env.VERSION }} | ||
| release_name: fluxpipe_${{ env.VERSION }} | ||
| draft: false | ||
|
|
||
13 changes: 13 additions & 0 deletions
.github/workflows/test.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| name: Test build | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: [main] | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v3 | ||
| - name: Build Fluxpipe | ||
| run: docker build --target export -t test . -f Dockerfile_musl --output out |
30 changes: 30 additions & 0 deletions
Dockerfile_musl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| FROM rust:1.70-alpine as RUSTBUILD | ||
|
|
||
| FROM golang:1.19-alpine as BUILDER | ||
|
|
||
| # Install rust and rust tooling | ||
| COPY --from=RUSTBUILD /usr/local/cargo /usr/local/cargo | ||
| COPY --from=RUSTBUILD /usr/local/rustup /usr/local/rustup | ||
|
|
||
| RUN apk add pkgconfig musl-dev gcc upx | ||
|
|
||
| ENV RUSTUP_HOME=/usr/local/rustup \ | ||
| CARGO_HOME=/usr/local/cargo \ | ||
| PATH=/go/bin:/usr/local/cargo/bin:/usr/local/bin:/usr/local/ragel7/bin:$PATH | ||
|
|
||
|
|
||
| RUN go install github.com/influxdata/pkg-config@latest | ||
|
|
||
| COPY . /src | ||
|
|
||
| RUN cd /src && sh build.sh && \ | ||
| strip fluxpipe-server && \ | ||
| strip fluxpipe-lambda && \ | ||
| strip fluxpipelib.a && \ | ||
| upx fluxpipe-server | ||
|
|
||
| FROM scratch as export | ||
|
|
||
| COPY --from=BUILDER /src/fluxpipe-server /fluxpipe-server | ||
| COPY --from=BUILDER /src/fluxpipe-lambda /fluxpipe-lambda | ||
| COPY --from=BUILDER /src/fluxpipelib.a /fluxpipelib.a |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,7 @@ | |
| # Make sure you have a complete flux build at `/usr/src/flux` | ||
|
|
||
| export PKG_CONFIG_PATH=$(pwd) | ||
| export PKG_CONFIG=`pwd`/pkg-config-static.sh | ||
|
|
||
| echo "Building fluxpipe-server ..." | ||
| go build -a -ldflags '-extldflags "-static -w -ldl"' -o fluxpipe-server ./cmd/server | ||
|
|
||
2 changes: 2 additions & 0 deletions
pkg-config-static.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| #!/bin/sh | ||
| pkg-config --static "$@" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.