-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.sh
executable file
·32 lines (24 loc) · 878 Bytes
/
build.sh
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
30
31
32
#!/usr/bin/env bash
# Remove old instance
echo -e "Removing old builds (if present)\n"
docker rm builder
docker rmi openconnect-sso-builder
rm -rf out
# Tag dockerfile
echo -e "Build and tag container\n"
docker build -t openconnect-sso-builder .
OVERRIDE_GO_VARIABLES=""
if [ -n "${GOOS}" ]; then
OVERRIDE_GO_VARIABLES+=" -e \"GOOS=${GOOS}\""
fi
if [ -n "${GOARCH}" ]; then
OVERRIDE_GO_VARIABLES+=" -e \"GOARCH=${GOARCH}\""
fi
# Run builder to create executable
echo -e "Run container and assign it the name \"builder\"\n"
sh -c "docker run ${OVERRIDE_GO_VARIABLES} --name builder openconnect-sso-builder"
# Copy output directory to current directory
echo -e "Copy executable from container to ./out directory\n"
docker cp builder:/opt/out ./out
echo "Copying ./out/openconnect-sso to /usr/bin/openconnect-sso"
sudo cp ./out/openconnect-sso /usr/bin/openconnect-sso