-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathload_or_build
More file actions
executable file
·39 lines (32 loc) · 1.7 KB
/
load_or_build
File metadata and controls
executable file
·39 lines (32 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash
source ./bits/bootstrap/logging
DOCKER_ASSETS_DIR=${DOCKER_ASSETS_DIR-./assets/dockerimages}
DOCKER_IMAGE_FILE=$DOCKER_ASSETS_DIR/${NAME}.${VERSION}.tar
IMAGE_ID=$(NAME=${NAME} VERSION=${VERSION} ./bits/docker/image)
FORCE_BUILD=${FORCE_BUILD-true}
SAVE_BUILD=${SAVE_BUILD-true}
OWNER=${OWNER-$USER}
if [[ "$FORCE_BUILD" == "skip" ]]; then
debug " -- Skipping load/build of DOCKER ${NAME} ${VERSION} altogether, change FORCE_BUILD=true to force it to build (or false to look for an image)"
elif [[ "$IMAGE_ID" != "" ]] && [[ "$FORCE_BUILD" != "true" ]]; then
debug " -- Image ${NAME} ${VERSION} already loaded, add FORCE_BUILD=true to force a build"
elif [[ "$DOCKER_ASSETS_SERVER" != "local" ]] && [[ "$FORCE_BUILD" != "true" ]]; then
debug " -- Attempting to load remote $DOCKER_IMAGE_FILE"
LAUNCHER_DIR=$LAUNCHER_DIR NAME=${NAME} VERSION=${VERSION} ./bits/docker/load
elif [[ -e $DOCKER_IMAGE_FILE ]] && [[ "$FORCE_BUILD" != "true" ]]; then
debug " -- Attempting to load $DOCKER_IMAGE_FILE, remove this file if you want to build from scratch"
LAUNCHER_DIR=$LAUNCHER_DIR NAME=${NAME} VERSION=${VERSION} ./bits/docker/load
else
if [[ "$FORCE_BUILD" == "true" ]]; then
debug " -- Forcing a build from scratch, set FORCE_BUILD=false to reload an existing image"
else
debug " -- No $DOCKER_IMAGE_FILE available, building from scratch"
fi
LAUNCHER_DIR=$LAUNCHER_DIR NAME=$NAME VERSION=$VERSION ./bits/docker/build
[ $? -ne 0 ] && exit 1
if [[ "$SAVE_BUILD" == "true" ]]; then
OWNER=$OWNER LAUNCHER_DIR=$LAUNCHER_DIR NAME=$NAME VERSION=$VERSION ./bits/docker/save
else
debug " -- Not saving Docker image NAME=$NAME VERSION=$VERSION, set SAVE_BUILD=true to enable saving it"
fi
fi