Skip to content

Commit a3c2280

Browse files
committed
fix(builder): only build slugbuilder/slugrunner when necessary
On start, the slugbuilder and slugrunner images are built from the builder's source directory. This is unnecessary on restarts, and prevents optimizations where the slugbuilder and slugrunner images are already pre-cached (for example, by bind-mounting a host volume into builder with the images). This commit simply wraps these `docker build` instructions in `docker history` checks to see if the images exist before attempting to build them.
1 parent 714a669 commit a3c2280

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

  • builder/rootfs/bin

builder/rootfs/bin/boot

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,14 @@ while [[ ! -e /var/run/docker.sock ]]; do
8585
sleep 1
8686
done
8787

88-
# build required images
89-
docker build -t deis/slugbuilder /usr/local/src/slugbuilder/
90-
docker build -t deis/slugrunner /usr/local/src/slugrunner/
88+
# build required images if they don't already exist
89+
if ! docker history deis/slugbuilder >/dev/null 2>&1; then
90+
docker build -t deis/slugbuilder /usr/local/src/slugbuilder/
91+
fi
92+
93+
if ! docker history deis/slugrunner >/dev/null 2>&1; then
94+
docker build -t deis/slugrunner /usr/local/src/slugrunner/
95+
fi
9196

9297
function gen_host_keys {
9398
if ! etcd_get sshHostKey; then

0 commit comments

Comments
 (0)