2018-12-10 10:30:19 -05:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
#
|
2021-11-17 11:18:15 -05:00
|
|
|
# Build plugins examples for the host OS/ARCH
|
2018-12-10 10:30:19 -05:00
|
|
|
#
|
|
|
|
|
|
|
|
set -eu -o pipefail
|
|
|
|
|
2024-09-03 04:49:50 -04:00
|
|
|
# Disable CGO - we don't need it for these plugins.
|
|
|
|
#
|
|
|
|
# Important: this must be done before sourcing "./scripts/build/.variables",
|
|
|
|
# because some other variables are conditionally set whether CGO is enabled.
|
|
|
|
export CGO_ENABLED=0
|
|
|
|
|
2018-12-10 10:30:19 -05:00
|
|
|
source ./scripts/build/.variables
|
|
|
|
|
2018-12-11 09:15:04 -05:00
|
|
|
for p in cli-plugins/examples/* "$@" ; do
|
2018-12-10 10:30:19 -05:00
|
|
|
[ -d "$p" ] || continue
|
|
|
|
|
|
|
|
n=$(basename "$p")
|
2021-11-17 11:18:15 -05:00
|
|
|
TARGET_PLUGIN="$(dirname "${TARGET}")/plugins-${GOOS}-${GOARCH}/docker-${n}"
|
|
|
|
mkdir -p "$(dirname "${TARGET_PLUGIN}")"
|
2018-12-10 10:30:19 -05:00
|
|
|
|
2021-11-17 11:18:15 -05:00
|
|
|
echo "Building $GO_LINKMODE $(basename "${TARGET_PLUGIN}")"
|
2024-09-03 04:49:50 -04:00
|
|
|
(set -x ; GO111MODULE=auto go build -o "${TARGET_PLUGIN}" -tags "${GO_BUILDTAGS}" -ldflags "${GO_LDFLAGS}" ${GO_BUILDMODE} "github.com/docker/cli/${p}")
|
2018-12-10 10:30:19 -05:00
|
|
|
done
|