Files
faunosteo/docker/rust-run.sh
T

25 lines
835 B
Bash
Executable File

#!/usr/bin/env bash
# Runs a command inside the reference Rust builder image with the repository mounted
# at /w. Cargo's registry and the target directory live in named Docker volumes
# (faunosteo_ prefix, DEPLOY.md "Docker resource naming") so incremental builds stay
# fast across runs while the host needs no Rust toolchain.
#
# bash docker/rust-run.sh cargo test --workspace --exclude faunosteo-worker
# bash docker/rust-run.sh bash docker/wasm-build.sh
set -euo pipefail
IMAGE="${FAUNOSTEO_RUST_BUILDER:-faunosteo_rust_builder:1.99.0}"
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
TTY_FLAG=()
if [ -t 0 ] && [ -t 1 ]; then
TTY_FLAG=(-t)
fi
exec docker run --rm -i "${TTY_FLAG[@]}" \
-v "$ROOT":/w \
-v faunosteo_cargo_registry:/usr/local/cargo/registry \
-v faunosteo_rust_target:/w/target \
-w /w \
"$IMAGE" "$@"