Skip to content

Commit

Permalink
build using custom docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
siddhantk232 committed Jan 2, 2024
1 parent 07e3068 commit f66ca75
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
17 changes: 6 additions & 11 deletions .github/workflows/static_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,19 @@ jobs:
test-release:
name: Build for Linux
runs-on: ubuntu-latest
container:
image: ekidd/rust-musl-builder
volumes:
- ${{ github.workspace }}:/home/rust/src
env:
CARGO_TERM_COLOR: always
steps:
- uses: actions/checkout@main
- name: Build-musl
run: |
echo "Building static binaries using ekidd/rust-musl-builder"
sudo chown rust -R /opt/rust/
rustup target add x86_64-unknown-linux-musl
RUSTFLAGS="-Clink-arg=-Wl,--allow-multiple-definition" cargo build --release --features=auth
- name: run fastn
run: ./target/x86_64-unknown-linux-musl/release/fastn --version
docker build -t fastn-build-image .
docker run -it --name fastn-build fastn-build-image
mkdir -p out
docker cp fastn-build:/home/rust/src/target/x86_64-unknown-linux-musl/release/fastn out/
- name: ls files
run: |
ls target/
ls target/x86_64-unknown-linux-musl/release/fastn
file target/x86_64-unknown-linux-musl/release/fastn
ls out/
file out/fastn
7 changes: 7 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM ekidd/rust-musl-builder

# We need to add the source code to the image because `rust-musl-builder`
# assumes a UID of 1000
ADD --chown=rust:rust . ./

CMD RUSTFLAGS="-Clink-arg=-Wl,--allow-multiple-definition" cargo build --release --features=auth

0 comments on commit f66ca75

Please sign in to comment.