-
Notifications
You must be signed in to change notification settings - Fork 1
/
push-images.sh
35 lines (34 loc) · 1.18 KB
/
push-images.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
#!/bin/sh
docker buildx ls
docker buildx create --name imagesbuilder --use
current_date=$(date '+%Y-%m-%d')
cd images
pwd=`pwd`
images=`ls $dir`
for image in $images
do
if [ -d $image ]
then
echo "🦁-----"
cd `echo $image`
policy="skip"
if [ -f "policy" ]; then
policy=`cat policy`
fi
echo "processing image $image with policy $policy."
if [ "$policy" = "skip" ]; then
image_check_url="https://hub.docker.com/v2/namespaces/acmestack/repositories/$(cat nametag | sed -e "s/:/\/tags\//g" nametag)"
image_check_status=$(curl --head $image_check_url --header 'application/json' -o /dev/null -s -w %{http_code})
echo "$image -> `cat nametag` check status $image_check_status."
if [ "$image_check_status" = "200" ] || [ "$image_check_status" = "403" ] ; then
echo "$image -> `cat nametag` pushed, skip..."
cd ..
continue
fi
fi
echo "building $image => `cat nametag`..."
docker buildx build --push --platform linux/amd64,linux/arm64 -t acmestack/`cat nametag` .
echo "done."
cd ..
fi
done