-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathbuild_and_push.sh
executable file
·45 lines (40 loc) · 1.23 KB
/
build_and_push.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
#!/bin/bash
IMAGES=(
"eduardosilva/wireguard_webadmin:latest"
"eduardosilva/wireguard_webadmin_cron:latest"
"eduardosilva/wireguard_webadmin_nginx:latest"
"eduardosilva/wireguard_webadmin_dns:latest"
"eduardosilva/wireguard_webadmin_rrdtool:latest"
)
build_images() {
echo "=========================================================================================="
echo "========== Starting the build of the images..."
docker compose -f docker-compose-build.yml build
if [ $? -eq 0 ]; then
echo "Build completed successfully."
else
echo "Error during the image build."
exit 1
fi
}
push_images() {
echo "=========================================================================================="
echo "========== Pushing images"
for IMAGE in "${IMAGES[@]}"; do
echo ""
echo ""
echo "=========================================================================================="
echo "========== Pushing image: $IMAGE..."
docker push "$IMAGE"
if [ $? -eq 0 ]; then
echo "$IMAGE pushed successfully."
else
echo "Error pushing the image: $IMAGE"
exit 1
fi
done
}
docker system prune -a
build_images
push_images
echo "Build and push operations completed successfully."