#!/usr/bin/env bash # # Runs any dotnet command inside the official .NET SDK container, for machines # without a local SDK installed. The repository is mounted at /src. # # Usage: # ./scripts/dotnet-docker.sh test # ./scripts/dotnet-docker.sh build CaddyManager.sln # ./scripts/dotnet-docker.sh test --filter FullyQualifiedName~RenameCaddyConfiguration # # NuGet packages are cached in a named volume so only the first run downloads them. set -euo pipefail repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" exec docker run --rm \ --volume "$repo_root":/src \ --workdir /src \ --volume caddymanager-nuget:/root/.nuget/packages \ mcr.microsoft.com/dotnet/sdk:9.0 \ dotnet "$@"