@@ -17,21 +17,22 @@ for v in "${versions[@]}"; do
17
17
continue
18
18
fi
19
19
20
- thisTarBase=" ubuntu-$v -core-cloudimg-$arch "
21
- thisTar=" $thisTarBase -root.tar.gz"
22
- baseUrl=" https://partner-images.canonical.com/core/$v /current"
23
-
24
- (
25
- cd " $v "
26
- wget -qN " $baseUrl /" {{MD5,SHA{1,256}}SUMS{,.gpg}," $thisTarBase .manifest" ,' unpacked/build-info.txt' }
27
- wget -N --progress=dot:giga " $baseUrl /$thisTar "
28
- )
29
-
30
- cat > " $v /Dockerfile" << EOF
20
+ case " $v " in
21
+ bionic | focal | groovy | hirsute | trusty | xenial)
22
+ thisTarBase=" ubuntu-$v -core-cloudimg-$arch "
23
+ thisTar=" $thisTarBase -root.tar.gz"
24
+ baseUrl=" https://partner-images.canonical.com/core/$v /current"
25
+ (
26
+ cd " $v "
27
+ wget -qN " $baseUrl /" {{MD5,SHA{1,256}}SUMS{,.gpg}," $thisTarBase .manifest" ,' unpacked/build-info.txt' }
28
+ wget -N --progress=dot:giga " $baseUrl /$thisTar "
29
+ )
30
+
31
+ cat > " $v /Dockerfile" << EOF
31
32
FROM scratch
32
33
ADD $thisTar /
33
34
EOF
34
- cat >> " $v /Dockerfile" << 'EOF '
35
+ cat >> " $v /Dockerfile" << 'EOF '
35
36
36
37
# a few minor docker-specific tweaks
37
38
# see https://github.com/docker/docker/blob/9a9fc01af8fb5d98b8eec0740716226fadb3735c/contrib/mkimage/debootstrap
@@ -65,31 +66,49 @@ RUN set -xe \
65
66
&& echo 'Apt::AutoRemove::SuggestsImportant "false";' > /etc/apt/apt.conf.d/docker-autoremove-suggests
66
67
EOF
67
68
68
- if [ " $v " = ' xenial' ]; then
69
- cat >> " $v /Dockerfile" << 'EOF '
69
+ if [ " $v " = ' xenial' ]; then
70
+ cat >> " $v /Dockerfile" << 'EOF '
70
71
71
72
# delete all the apt list files since they're big and get stale quickly
72
73
RUN rm -rf /var/lib/apt/lists/*
73
74
# this forces "apt-get update" in dependent images, which is also good
74
75
# (see also https://bugs.launchpad.net/cloud-images/+bug/1699913)
75
76
EOF
76
- else
77
- cat >> " $v /Dockerfile" << 'EOF '
77
+ else
78
+ cat >> " $v /Dockerfile" << 'EOF '
78
79
79
80
# verify that the APT lists files do not exist
80
81
RUN [ -z "$(apt-get indextargets)" ]
81
82
# (see https://bugs.launchpad.net/cloud-images/+bug/1699913)
82
83
EOF
83
- fi
84
+ fi
84
85
85
- cat >> " $v /Dockerfile" << 'EOF '
86
+ cat >> " $v /Dockerfile" << 'EOF '
86
87
87
88
# make systemd-detect-virt return "docker"
88
89
# See: https://github.com/systemd/systemd/blob/aa0c34279ee40bce2f9681b496922dedbadfca19/src/basic/virt.c#L434
89
90
RUN mkdir -p /run/systemd && echo 'docker' > /run/systemd/container
90
91
91
92
CMD ["/bin/bash"]
92
93
EOF
94
+ ;;
95
+
96
+ * )
97
+ thisTarBase=" ubuntu-$v -oci-$arch "
98
+ thisTar=" $thisTarBase -root.tar.gz"
99
+ baseUrl=" https://partner-images.canonical.com/oci/$v /current"
100
+ (
101
+ cd " $v "
102
+ wget -qN " $baseUrl /" {SHA256SUMS{,.gpg}," $thisTarBase .manifest" ,' unpacked/build-info.txt' }
103
+ wget -N --progress=dot:giga " $baseUrl /$thisTar "
104
+ )
105
+ cat > " $v /Dockerfile" << -EOF
106
+ FROM scratch
107
+ ADD $thisTar /
108
+ CMD ["bash"]
109
+ EOF
110
+ ;;
111
+ esac
93
112
94
113
toVerify+=( " $v " )
95
114
done
0 commit comments