1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
moby--moby/project/make/.ensure-busybox
Tianon Gravi 351074edcd Download busybox from the Hub instead of GitHub
This downloads a specific image ID of `busybox:latest` from the Hub directly (within the `Dockerfile`, ready for `docker load`) instead of grabbing the source from GitHub and doing a `docker build` at daemon start time.  This ensures the test suite runs more consistently.

Signed-off-by: Andrew "Tianon" Page <admwiggin@gmail.com>
2015-03-02 14:38:19 -07:00

21 lines
748 B
Bash

#!/bin/bash
set -e
if ! docker inspect busybox &> /dev/null; then
hardCodedDir='/docker-busybox'
if [ -d "$hardCodedDir" ]; then
( set -x; tar -cC "$hardCodedDir" . | docker load )
elif [ -e Dockerfile ] && command -v curl > /dev/null; then
# testing for "curl" because "download-frozen-image.sh" is built around curl
dir="$DEST/busybox"
# extract the exact "download-frozen-image.sh" line from the Dockerfile itself for consistency
awk '$1 == "RUN" && $2 == "./contrib/download-frozen-image.sh" && /busybox@/ {
for (i = 2; i < NF; i++)
printf ( $i == "'"$hardCodedDir"'" ? "'"$dir"'" : $i ) " ";
print $NF;
}' Dockerfile | sh -x
( set -x; tar -cC "$dir" . | docker load )
else
( set -x; docker pull busybox )
fi
fi