-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathci.sh
More file actions
42 lines (31 loc) · 923 Bytes
/
ci.sh
File metadata and controls
42 lines (31 loc) · 923 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
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash
set -e
name='base'
namespace='alpinelib'
declare -A aliases
aliases=(
["3.3"]='3 latest'
)
versions=( */ )
versions=( "${versions[@]%/}" )
for version in "${versions[@]}"; do
fullVersion="$(grep -m1 'ENV ALPINE_VERSION ' "$version/Dockerfile" | cut -d' ' -f3)"
versionAliases=()
while [ "$fullVersion" != "$version" -a "${fullVersion%[.-]*}" != "$fullVersion" ]; do
versionAliases+=( $fullVersion )
fullVersion="${fullVersion%[.-]*}"
done
versionAliases+=( $version ${aliases[$version]} )
cd $version
echo "build docker image $version"
ID=$(docker build . | tail -1 | sed 's/.*Successfully built \(.*\)$/\1/')
cd ..
for va in "${versionAliases[@]}"; do
echo "TAG image $ID -> $namespace/$name:$va"
docker tag -f $ID $namespace/$name:$va
if [ $PUSH_IMAGE ]; then
echo "PUSH image $ID -> $namespace/$name:$va"
docker push $namespace/$name:$va
fi
done
done