mirror of
https://github.com/shadowsocks/shadowsocks-rust.git
synced 2026-11-06 16:14:11 +00:00
build static linked binary (#60)
Add build guide for making static-linked binaries
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
FROM ekidd/rust-musl-builder
|
||||
|
||||
# Build a static copy of libsodium.
|
||||
RUN VERS=1.0.13 && \
|
||||
cd /home/rust/libs && \
|
||||
curl -LO https://download.libsodium.org/libsodium/releases/libsodium-$VERS.tar.gz && \
|
||||
tar xzf libsodium-$VERS.tar.gz && cd libsodium-$VERS && \
|
||||
CC=musl-gcc ./configure --prefix=/usr/local/musl && \
|
||||
make && sudo make install && \
|
||||
cd .. && rm -rf libsodium-$VERS.tar.gz libsodium-$VERS
|
||||
|
||||
ENV SODIUM_STATIC=yes
|
||||
ENV SODIUM_LIB_DIR=/usr/local/musl/lib
|
||||
@@ -0,0 +1,11 @@
|
||||
Compile static-linked binaries with [`rust-musl-builder`](https://github.com/emk/rust-musl-builder):
|
||||
|
||||
```sh
|
||||
# build image use Dockerfile in build dir.
|
||||
docker build -t shadowsocks_rust:0.0.1 .
|
||||
# run command in project root.
|
||||
alias rust-musl-builder='docker run --rm -it -v "$(pwd)":/home/rust/src shadowsocks_rust:0.0.1'
|
||||
rust-musl-builder cargo build --release
|
||||
```
|
||||
|
||||
At the moment, it doesn't attempt to cache libraries between builds, so this is best reserved for making final release builds.
|
||||
Reference in New Issue
Block a user