Skip to content

Commit fa85f9f

Browse files
committed
Move to official Rust Alpine Docker image
The previous image appears to be mostly unmaintained: emk/rust-musl-builder#147
1 parent 1667a78 commit fa85f9f

File tree

2 files changed

+21
-15
lines changed

2 files changed

+21
-15
lines changed

.github/workflows/ci.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -194,17 +194,20 @@ jobs:
194194
args: "--manifest-path top-crates/Cargo.toml --check"
195195
- name: Build backend
196196
run: |-
197-
mkdir -p ui/target; docker run --rm -v $PWD/ui:/ui -v ~/.cargo/git:/home/rust/.cargo/git -v ~/.cargo/registry:/home/rust/.cargo/registry --workdir /ui ekidd/rust-musl-builder:stable bash -c $'
198-
sudo chown -R rust:rust /home/rust/.cargo /ui/target;
197+
mkdir -p ui/target; docker run --rm -v $PWD/ui:/ui -v ~/.cargo/git:/root/.cargo/git -v ~/.cargo/registry:/root/.cargo/registry --workdir /ui rust:alpine sh -c '
198+
apk add musl-dev openssl-dev
199199
200200
# Unit tests
201-
cargo test --locked --target=x86_64-unknown-linux-musl --no-run;
202-
test_bin=$(find target/x86_64-unknown-linux-musl/debug/deps/ -type f -perm -a=x);
201+
# https://github.com/rust-lang/rust/issues/95926
202+
# https://users.rust-lang.org/t/sigsegv-with-program-linked-against-openssl-in-an-alpine-container/52172/4
203+
cargo rustc --tests --locked -- -C relocation-model=static -C target-feature=-crt-static;
204+
205+
test_bin=$(find target/debug/deps/ -name "ui*" -type f -perm -a=x);
203206
mv "${test_bin}" target/unit_tests;
204207
205208
# Primary binary
206-
cargo build --locked --target=x86_64-unknown-linux-musl --release;
207-
mv target/x86_64-unknown-linux-musl/release/ui target/ui;
209+
cargo rustc --locked --release -- -C relocation-model=static -C target-feature=-crt-static;
210+
mv target/release/ui target/ui;
208211
'
209212
- name: Restore permissions
210213
run: sudo chown -R runner:docker ~/.cargo/ ui/target

ci/workflows.yml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -298,21 +298,24 @@ workflows:
298298
run
299299
--rm
300300
-v $PWD/ui:/ui
301-
-v ~/.cargo/git:/home/rust/.cargo/git
302-
-v ~/.cargo/registry:/home/rust/.cargo/registry
301+
-v ~/.cargo/git:/root/.cargo/git
302+
-v ~/.cargo/registry:/root/.cargo/registry
303303
--workdir /ui
304-
ekidd/rust-musl-builder:stable
305-
bash -c $'
306-
sudo chown -R rust:rust /home/rust/.cargo /ui/target;
304+
rust:alpine
305+
sh -c '
306+
apk add musl-dev openssl-dev
307307
308308
# Unit tests
309-
cargo test --locked --target=x86_64-unknown-linux-musl --no-run;
310-
test_bin=$(find target/x86_64-unknown-linux-musl/debug/deps/ -type f -perm -a=x);
309+
# https://github.com/rust-lang/rust/issues/95926
310+
# https://users.rust-lang.org/t/sigsegv-with-program-linked-against-openssl-in-an-alpine-container/52172/4
311+
cargo rustc --tests --locked -- -C relocation-model=static -C target-feature=-crt-static;
312+
313+
test_bin=$(find target/debug/deps/ -name "ui*" -type f -perm -a=x);
311314
mv "${test_bin}" target/unit_tests;
312315
313316
# Primary binary
314-
cargo build --locked --target=x86_64-unknown-linux-musl --release;
315-
mv target/x86_64-unknown-linux-musl/release/ui target/ui;
317+
cargo rustc --locked --release -- -C relocation-model=static -C target-feature=-crt-static;
318+
mv target/release/ui target/ui;
316319
'
317320
318321
- name: "Restore permissions"

0 commit comments

Comments
 (0)