Skip to content

Commit 1194fbd

Browse files
committed
suggestion
1 parent 2fae97e commit 1194fbd

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

scripts/build.sh

+9-10
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
#!/usr/bin/env bash
22

3-
cd $(dirname "${BASH_SOURCE[0]}")
3+
cd "$(dirname "${BASH_SOURCE[0]}")"
44
set -euxo pipefail
55

66
# Set CI to false if not set
77
CI=${CI:-false}
88

9-
109
# Get current architecture
1110
current=$(go env GOARCH)
1211
# Arhcitectures to build for
@@ -15,7 +14,7 @@ archs=(amd64 arm64 arm)
1514
# build for all architectures
1615
for arch in "${archs[@]}"; do
1716
echo "Building for $arch"
18-
GOARCH=$arch GOOS=linux CGO_ENABLED=0 go build -ldflags "-s -w" -o ./coder-logstream-kube-$arch ../
17+
GOARCH=$arch GOOS=linux CGO_ENABLED=0 go build -ldflags "-s -w" -o ./coder-logstream-kube-"$arch" ../
1918
done
2019

2120
# We have to use docker buildx to tag multiple images with
@@ -25,21 +24,21 @@ BUILDER_EXISTS=$(docker buildx ls | grep $BUILDER_NAME || true)
2524

2625
# If builder doesn't exist, create it
2726
if [ -z "$BUILDER_EXISTS" ]; then
28-
echo "Creating dockerx builder $BUILDER_NAME..."
29-
docker buildx create --use --platform=linux/arm64,linux/amd64,linux/arm/v7 --name $BUILDER_NAME
27+
echo "Creating dockerx builder $BUILDER_NAME..."
28+
docker buildx create --use --platform=linux/arm64,linux/amd64,linux/arm/v7 --name $BUILDER_NAME
3029
else
31-
echo "Builder $BUILDER_NAME already exists. Using it."
30+
echo "Builder $BUILDER_NAME already exists. Using it."
3231
fi
3332

3433
# Ensure the builder is bootstrapped and ready to use
35-
docker buildx inspect --bootstrap &> /dev/null
34+
docker buildx inspect --bootstrap &>/dev/null
3635

3736
# Build
3837
if [ "$CI" = "false" ]; then
39-
docker buildx build --platform linux/$current -t coder-logstream-kube --load .
38+
docker buildx build --platform linux/"$current" -t coder-logstream-kube --load .
4039
else
4140
VERSION=$(../scripts/version.sh)
4241
BASE=ghcr.io/coder/coder-logstream-kube
4342
IMAGE=$BASE:$VERSION
44-
docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t $IMAGE -t $BASE:latest --push.
45-
fi
43+
docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t "$IMAGE" -t $BASE:latest --push.
44+
fi

0 commit comments

Comments
 (0)