Docker images for compiling static Rust binaries using musl-libc and musl-gcc, with static versions of useful C libraries. Supports openssl and diesel crates.
I did this in Makefile to compile it into static, It works fine and I get a static binary, this binary can also work on my PC (ubuntu18.10), but when I upload it to a public server (ubuntu18.04).
if [ ! "$(shell docker image ls | grep muslrust)" ]; then \
docker pull clux/muslrust ;\
fi ;\
echo "$(GREEN)=> building...$(END)" && \
docker run -v "$(shell pwd)":/volume -v cargo-cache:/root/.cargo/registry --rm -t clux/muslrust cargo build --manifest-path=server/Cargo.toml
It can start without error but it cannot load my VueJs client anymore, the client is compiled into this binary.
Then I switch to use cargo build --release and upload the new dynamic binary to my public server, it works and succeed to load static files (which has been embeded into the binary).
Hello, I have a project with these dependencies
I did this in
Makefile
to compile it into static, It works fine and I get a static binary, this binary can also work on my PC (ubuntu18.10), but when I upload it to a public server (ubuntu18.04).It can start without error but it cannot load my
VueJs
client anymore, the client is compiled into this binary.Then I switch to use
cargo build --release
and upload the new dynamic binary to my public server, it works and succeed to load static files (which has been embeded into the binary).