-
-
Notifications
You must be signed in to change notification settings - Fork 90
/
create_image.sh
executable file
·58 lines (45 loc) · 1.7 KB
/
create_image.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
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash
set -e
DOCKER_VERSION="27.4.1"
BUILD_NUMBER="0"
LATEST_UBUNTU_VERSION="24.04"
declare -A ubuntu_versions=(
["20.04"]="focal"
["22.04"]="jammy"
["24.04"]="noble"
)
build_image() {
local ubuntu_version=$1
local ubuntu_name=$2
echo "Building image for Ubuntu ${ubuntu_version} (${ubuntu_name})"
docker build \
--build-arg UBUNTU_VERSION=${ubuntu_version} \
-t cruizba/ubuntu-dind:${ubuntu_name}-${DOCKER_VERSION} \
-t cruizba/ubuntu-dind:${ubuntu_name}-${DOCKER_VERSION}-r${BUILD_NUMBER} \
-t cruizba/ubuntu-dind:${ubuntu_name}-latest \
-f Dockerfile .
if [ "${ubuntu_version}" == "${LATEST_UBUNTU_VERSION}" ]; then
docker tag cruizba/ubuntu-dind:${ubuntu_name}-latest cruizba/ubuntu-dind:latest
fi
}
build_systemd_image() {
local ubuntu_version=$1
local ubuntu_name=$2
echo "Building image for Ubuntu ${ubuntu_version} (${ubuntu_name}) with systemd"
docker build \
--build-arg UBUNTU_VERSION=${ubuntu_version} \
-t cruizba/ubuntu-dind:${ubuntu_name}-systemd-${DOCKER_VERSION} \
-t cruizba/ubuntu-dind:${ubuntu_name}-systemd-${DOCKER_VERSION}-r${BUILD_NUMBER} \
-t cruizba/ubuntu-dind:${ubuntu_name}-systemd-latest \
-f Dockerfile.systemd .
if [ "${ubuntu_version}" == "${LATEST_UBUNTU_VERSION}" ]; then
docker tag cruizba/ubuntu-dind:${ubuntu_name}-systemd-latest cruizba/ubuntu-dind:systemd-latest
fi
}
for version in "${!ubuntu_versions[@]}"; do
build_image "$version" "${ubuntu_versions[$version]}"
done
for version in "${!ubuntu_versions[@]}"; do
build_systemd_image "$version" "${ubuntu_versions[$version]}"
done
echo "All images built successfully!"