-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_all.sh
More file actions
30 lines (22 loc) · 864 Bytes
/
Copy pathbuild_all.sh
File metadata and controls
30 lines (22 loc) · 864 Bytes
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
for d in */ ; do
cd $d
echo $PWD
image_name=${d%"/"}
echo "Building ${image_name}..."
docker build . --file Dockerfile --tag ${image_name} --label "runnumber=${GITHUB_RUN_ID}"
IMAGE_ID=ghcr.io/${GITHUB_REPO_OWNER}/${image_name}
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
# Strip git ref prefix from version
VERSION=$(echo "$GITHUB_REF" | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name
# The [[ thingy requires bash!
[[ "$GITHUB_REF" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
# Use Docker `latest` tag convention
[ "$VERSION" == "main" ] && VERSION=latest
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag ${image_name} $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION
cd ..
done