-
Notifications
You must be signed in to change notification settings - Fork 1
/
build-release
executable file
·34 lines (32 loc) · 1.42 KB
/
build-release
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
#
# Usage: ./build-release <PROJECT> ${TRAVIS_TAG}-${TRAVIS_OS_NAME}
#
# The original/latest version of this script is available at
# https://github.com/emk/rust-musl-builder/blob/master/examples/build-release
#
# Called by `.travis.yml` to build release binaries. We use
# ekidd/rust-musl-builder to make the Linux binaries so that we can run
# them unchanged on any distro, including tiny distros like Alpine (which
# is heavily used for Docker containers). Other platforms get regular
# binaries, which will generally be dynamically linked against libc.
set -euo pipefail
case `uname -s` in
Linux)
echo "Building static binaries using ekidd/rust-musl-builder"
docker build -f Dockerfile.build -t build-"$1" .
docker run -e CARGO_ARGS=--release --name build-"$1"-run build-"$1"
mkdir bin
docker cp build-"$1"-run:/home/rust/src/target/x86_64-unknown-linux-musl/release/falconeri bin/falconeri
docker cp build-"$1"-run:/home/rust/src/target/x86_64-unknown-linux-musl/release/falconeri-worker bin/falconeri-worker
docker cp build-"$1"-run:/home/rust/src/guide/book gh-pages
docker rm build-"$1"-run
docker rmi build-"$1"
zip -j "$1"_"$2".zip bin/falconeri bin/falconeri-worker
;;
*)
echo "Building standard release binaries"
cargo build -p falconeri --release
zip -j "$1"_"$2".zip target/release/"$1"
;;
esac