-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·29 lines (21 loc) · 881 Bytes
/
build.sh
File metadata and controls
executable file
·29 lines (21 loc) · 881 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env bash
set -e
OPA_VERSION=$(go list -m -f '{{.Version}}' github.com/open-policy-agent/opa)
echo "Building opa-docker-authz version: $VERSION (OPA version: $OPA_VERSION)"
platforms=("linux/amd64" "linux/arm64" "darwin/amd64" "darwin/arm64" "windows/amd64")
for platform in "${platforms[@]}"
do
platform_split=(${platform//\// })
GOOS=${platform_split[0]}
GOARCH=${platform_split[1]}
echo -e "\nBuilding opa-docker-authz for $platform ..."
CGO_ENABLED=0 GOOS=$GOOS GOARCH=$GOARCH go build -ldflags \
"-X github.com/open-policy-agent/opa-docker-authz/version.Version=$VERSION -X github.com/open-policy-agent/opa-docker-authz/version.OPAVersion=$OPA_VERSION" \
-buildvcs=false \
-o opa-docker-authz-$GOOS-$GOARCH
if [ $? -ne 0 ]; then
echo 'An error has occurred! Aborting the script execution...'
exit 1
fi
done
echo -e "\n... done!"