-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpush.sh
More file actions
executable file
·44 lines (33 loc) · 1.02 KB
/
push.sh
File metadata and controls
executable file
·44 lines (33 loc) · 1.02 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
#!/bin/bash
# build-simple.sh
REGISTRY="${1:-localhost:5005}"
PUSH="${2}"
export DOCKER_DEFAULT_PLATFORM=linux/amd64
for dockerfile in $(find registry -name Dockerfile | sort); do
dir=$(dirname "$dockerfile")
path="${dir#./}"
path="${path#registry/}"
echo "Processing path: ${path}"
if [[ "$path" =~ ^([^/]+)/([^/]+)/(.+)$ ]]; then
type="${BASH_REMATCH[1]}"
echo "Type: ${type}"
lang="${BASH_REMATCH[2]}"
echo "Language: ${lang}"
version="${BASH_REMATCH[3]}"
echo "Version: ${version}"
tag="${REGISTRY}/${type}/${lang}:${version}"
echo "Building ${tag}..."
if docker build --platform linux/amd64 -t "${tag}" "${dir}"; then
echo "✓ Built successfully"
if [ "$PUSH" == "--push" ]; then
echo "Pushing ${tag}..."
docker push "${tag}"
fi
else
echo "✗ Build failed"
fi
echo "---"
fi
done
echo "Done!"
docker images | grep "${REGISTRY}"