-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
54 lines (43 loc) · 1.14 KB
/
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/bash
# Exit on error
set -e
# Determine platform
case $(uname -m) in
"x86_64")
PLATFORM="linux/amd64"
;;
"aarch64")
PLATFORM="linux/arm64"
;;
"arm64")
PLATFORM="linux/arm64"
;;
*)
echo "Unsupported architecture: $(uname -m)"
exit 1
;;
esac
REGISTRY="clickplanet"
VERSION="latest"
echo "Building for platform: $PLATFORM"
# Build each service
services=("country-watchguard" "tile-syncer" "click-server" "state-click-persister" )
dockerfiles=("Dockerfile.watchguard-robot" "Dockerfile.tile-syncer-robot" "Dockerfile.click-server" "Dockerfile.click-persister")
for i in "${!services[@]}"; do
SERVICE=${services[$i]}
DOCKERFILE=${dockerfiles[$i]}
echo "Building $SERVICE for $PLATFORM..."
docker buildx build \
--platform $PLATFORM \
--file $DOCKERFILE \
--tag $REGISTRY/$SERVICE:$VERSION \
--load \
.
echo "Successfully built $SERVICE"
done
echo "All images have been built for $PLATFORM"
# List the images
echo "Created images:"
for SERVICE in "${services[@]}"; do
echo "$REGISTRY/$SERVICE:$VERSION"
done