Skip to content

Commit 73a5cbc

Browse files
committed
Update the workflow for building new images.
Signed-off-by: Daniel Nephin <[email protected]>
1 parent 595e981 commit 73a5cbc

File tree

7 files changed

+58
-77
lines changed

7 files changed

+58
-77
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ $ docker run --rm --privileged -it dockerswarm/dind:1.0.0 docker version
2222
Client version: 1.0.0
2323
```
2424

25-
## Tools
25+
## Build
2626

27-
## build_and_push.sh
28-
29-
Build and push the given Docker images. If not arguments are given, it will build and push **all** images.
27+
```
28+
./build.sh VERSION
29+
```

build.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
set -e
3+
4+
if [[ -z "$1" ]]; then
5+
>&2 echo "Usage: $(basename $0) <version>"
6+
exit 1
7+
fi
8+
9+
VERSION=$1
10+
docker build --build-arg=VERSION=$VERSION -t dockerswarm/dind:$VERSION .

build_and_push.sh

Lines changed: 0 additions & 35 deletions
This file was deleted.

ci.sh

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/bin/bash
2+
#
3+
# Check for new docker versions. Build and push an image for the latest
4+
# version if it doesn't already exist.
5+
#
6+
7+
set -e
8+
9+
DOCKER_REPOSITORY=https://github.com/docker/docker.git
10+
11+
MIN_DOCKER_VERSION_TAG=${MIN_DOCKER_VERSION_TAG-"v1.8.2"}
12+
13+
DOCKER_IMAGE=${DOCKER_IMAGE:-dockerswarm/dind}
14+
15+
# Sort versions correctly with rc releases. This will break if there
16+
# are more than 9 bug fix releases in a minor version
17+
function tags_after() {
18+
local min_version=$1
19+
sort -t"." -k "1,3.1Vr" -k "3.2,3.2" | \
20+
sed "/^${min_version}\$/q" | \
21+
sort -t"." -k "1,3.1V" -k "3.2,3.2r"
22+
}
23+
24+
# Docker version tags starting from MIN_VERSION
25+
latest=$(
26+
git ls-remote --tags $DOCKER_REPOSITORY v\* |
27+
awk -F'/' '{ print $3 }' |
28+
grep -v "\^{}" |
29+
tags_after $MIN_DOCKER_VERSION_TAG |
30+
tail -1 |
31+
sed "s/^v//"
32+
)
33+
34+
image="${DOCKER_IMAGE}:${latest}"
35+
36+
if docker pull $image; then
37+
echo "Version $latest already exists."
38+
exit
39+
fi
40+
41+
echo "Building version $latest"
42+
./build.sh $latest
43+
docker push $image

get_docker.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ else
1212
HOST=get.docker.com
1313
fi
1414

15-
curl -L -f -s -o /usr/local/bin/docker \
15+
curl -L -f -o /usr/local/bin/docker \
1616
https://$HOST/builds/Linux/x86_64/docker-${VERSION}
1717

1818
chmod +x /usr/local/bin/docker

utils.sh

Lines changed: 0 additions & 21 deletions
This file was deleted.

wipe.sh

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)