github.com/kaisenlinux/docker.io@v0.0.0-20230510090727-ea55db55fac7/cli/scripts/build/.variables (about) 1 #!/usr/bin/env sh 2 set -eu 3 4 TARGET=${TARGET:-"build"} 5 6 PLATFORM=${PLATFORM:-} 7 VERSION=${VERSION:-$(git describe --match 'v[0-9]*' --dirty='.m' --always --tags | sed 's/^v//' 2>/dev/null || echo "unknown-version" )} 8 GITCOMMIT=${GITCOMMIT:-$(git rev-parse --short HEAD 2> /dev/null || true)} 9 BUILDTIME=${BUILDTIME:-$(date -u +"%Y-%m-%dT%H:%M:%SZ")} 10 11 PLATFORM_LDFLAGS= 12 if test -n "${PLATFORM}"; then 13 PLATFORM_LDFLAGS="-X \"github.com/docker/cli/cli/version.PlatformName=${PLATFORM}\"" 14 fi 15 16 export GO_LDFLAGS="\ 17 -w \ 18 ${PLATFORM_LDFLAGS} \ 19 -X \"github.com/docker/cli/cli/version.GitCommit=${GITCOMMIT}\" \ 20 -X \"github.com/docker/cli/cli/version.BuildTime=${BUILDTIME}\" \ 21 -X \"github.com/docker/cli/cli/version.Version=${VERSION}\" \ 22 ${GO_LDFLAGS:-} \ 23 " 24 25 GOOS="$(go env GOOS)" 26 GOARCH="$(go env GOARCH)" 27 if [ "${GOARCH}" = "arm" ]; then 28 GOARM="$(go env GOARM)" 29 fi 30 31 TARGET="$TARGET/docker-${GOOS}-${GOARCH}" 32 if [ "${GOARCH}" = "arm" ] && [ -n "${GOARM}" ]; then 33 TARGET="${TARGET}-v${GOARM}" 34 fi 35 36 if [ "${GOOS}" = "windows" ]; then 37 TARGET="${TARGET}.exe" 38 fi 39 export TARGET 40 41 export SOURCE="github.com/docker/cli/cmd/docker"