Fix build-release example to work on current TravisCI

The Travis UUID has been changed from 1000 to 2000, so now making images
is considerably more annoying than before.
This commit is contained in:
Eric Kidd 2017-10-24 09:33:56 -04:00
parent 0c08aa7e47
commit 4959d3188a
2 changed files with 19 additions and 6 deletions

View file

@ -87,6 +87,19 @@ deploy:
Next, copy [`build-release`](./examples/build-release) into your project and run `chmod +x build-release`. Next, copy [`build-release`](./examples/build-release) into your project and run `chmod +x build-release`.
Finally, add a `Dockerfile` to perform the actual build:
```rust
FROM ekidd/rust-musl-builder
# We need to add the source code to the image because `rust-musl-builder`
# assumes a UID of 1000, but TravisCI has switched to 2000.
ADD . ./
RUN sudo chown -R rust:rust .
CMD cargo build --release
```
When you push a new tag to your project, `build-release` will automatically build new Linux binaries using `rust-musl-builder`, and new Mac binaries with Cargo, and it will upload both to the GitHub releases page for your repository. When you push a new tag to your project, `build-release` will automatically build new Linux binaries using `rust-musl-builder`, and new Mac binaries with Cargo, and it will upload both to the GitHub releases page for your repository.
For a working example, see [faradayio/cage][cage]. For a working example, see [faradayio/cage][cage].

View file

@ -16,15 +16,15 @@
set -euo pipefail set -euo pipefail
rust-musl-builder() {
docker run --rm -it -v "$(pwd)":/home/rust/src ekidd/rust-musl-builder "$@"
}
case `uname -s` in case `uname -s` in
Linux) Linux)
echo "Building static binaries using ekidd/rust-musl-builder" echo "Building static binaries using ekidd/rust-musl-builder"
rust-musl-builder cargo build --release docker build -t build-"$1"-image .
zip -j "$1"-"$2".zip target/x86_64-unknown-linux-musl/release/"$1" docker run -it --name build-"$1" build-"$1"-image
docker cp build-"$1":/home/rust/src/target/x86_64-unknown-linux-musl/release/"$1" "$1"
docker rm build-"$1"
docker rmi build-"$1"-image
zip "$1"-"$2".zip "$1"
;; ;;
*) *)
echo "Building standard release binaries" echo "Building standard release binaries"