#!/bin/bash # Abort if anything goes wrong. set -euo pipefail # Decide what Rust toolchain to use. case "$DOCKER_TAG" in # Always map the Docker tags `latest` and `experimental` to stable Rust. latest|experimental) TOOLCHAIN=stable ;; # Strip `experimental-` from other `experimental-*` tags. experimental-*) TOOLCHAIN="${DOCKER_TAG/experimental-/}" ;; # Pass all our tags *) TOOLCHAIN="$DOCKER_TAG" ;; esac # Run the build. docker build --build-arg TOOLCHAIN="$TOOLCHAIN" -t "$IMAGE_NAME" .