-
Notifications
You must be signed in to change notification settings - Fork 136
Expand file tree
/
Copy pathdocker-build.sh
More file actions
executable file
·68 lines (46 loc) · 1.86 KB
/
docker-build.sh
File metadata and controls
executable file
·68 lines (46 loc) · 1.86 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/sh
if [ -z "$1" ]; then
echo "Required argument misses. Please provide docker image tag or registry url flag."
echo ""
echo "USAGE"
echo " docker-build.sh [--registry-url url] tag1 [tag2 tag3 ...]"
echo "DESCRIPTION"
echo " --registry-url url\t- optional flag to push image to registry other than dockerhub.io If AWS ECR URL script would attemt AWS login."
echo " tag\t\t- arbitrary docker image tag(s). In bytechef we use yyyyMMdd to reflect date of image build."
exit 1
fi
dckr_img_registry_bytechef_server="bytechef/bytechef-server"
dckr_img_registry_bytechef="bytechef/bytechef"
if [ "$1" = "--registry-url" ]; then
if [ -z "$2" ]; then
echo "Registry URL is required when using the --registry-url flag."
exit 1
fi
echo "Logging in to AWS ECR with URL: $2"
aws ecr get-login-password --region eu-west-1 | docker login --username AWS --password-stdin "$2"
dckr_img_registry_bytechef="$2/bc-prod-app"
shift 2
fi
cd server/apps/server-app
../../../gradlew clean build -Pprod
for tag in "$@"; do
echo "Building docker image with tag \`$tag\`"
docker build --progress=plain --platform linux/amd64 --no-cache -t $dckr_img_registry_bytechef_server:$tag .
done
cd ../../../client
npm install
npm run build
cd ..
for tag in "$@"; do
echo "Building docker image with tag \`$tag\`"
docker build --progress=plain --platform linux/amd64 --no-cache -t $dckr_img_registry_bytechef:$tag .
done
echo "Push images to the remote docker registry \`$dckr_img_registry_bytechef\`"
for tag in "$@"; do
dckr_push_argument="$dckr_img_registry_bytechef_server:$tag"
echo "Pushing image \`$dckr_push_argument\`"
docker push $dckr_push_argument
dckr_push_argument="$dckr_img_registry_bytechef:$tag"
echo "Pushing image \`$dckr_push_argument\`"
docker push $dckr_push_argument
done