cookbook/container: example of building+running docker containers.

This got... long... and complicated.  But I think it's a really good
demonstration of getting redo to do complicated things elegantly.  At
least, I hope it is.
This commit is contained in:
Avery Pennarun 2019-01-02 23:46:01 -05:00
commit 3923a7d3f8
38 changed files with 1375 additions and 7 deletions

View file

@ -0,0 +1,25 @@
exec >&2
# We can pull in the 'hello' binary built in an earlier
# example. Notice that it's safe to have dependencies
# that cross directory boundaries, even when we're building
# both of those directories in parallel.
FILES="
/bin/sh
../hello/hello
"
if [ -x /bin/busybox ]; then
# Optional, except for runkvm
FILES="$FILES /bin/busybox"
else
redo-ifcreate /bin/busybox
fi
redo-ifchange $FILES
fs=${1%.fs}
rm -rf "$fs"
mkdir -p "$fs/bin"
cp $FILES "$fs/bin/"
ln -s bin/hello "$fs/init"
redo-ifchange "$fs/bin/sh"