-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathload
More file actions
executable file
·44 lines (37 loc) · 1.54 KB
/
load
File metadata and controls
executable file
·44 lines (37 loc) · 1.54 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
40
41
42
43
44
#!/bin/bash
source ./bits/bootstrap/logging
export DOCKER_ASSETS_DIR=${DOCKER_ASSETS_DIR-./assets/dockerimages}
IMAGE_NAME=${IMAGE_NAME-$NAME:$VERSION}
LOAD_OUTPUT=${LAUNCHER_DIR}/docker_save.log
if [[ "$FORCE_BUILD" == "skip" ]]; then
debug " -- Skipping load of DOCKER ${NAME} ${VERSION} altogether, change FORCE_BUILD=true to force it to build (or false to look for an image)"
exit 0
elif [[ "$DOCKER_ASSETS_SERVER" != "local" ]]; then
SERVER=$DOCKER_ASSETS_SERVER DIR=$DOCKER_ASSETS_DIR TO_DIR=/tmp \
FILENAME=${NAME}.${VERSION}.tar.gz ./bits/bootstrap/scp
[ $? -ne 0 ] && exit 1
DOCKER_IMAGE_FILE=/tmp/${NAME}.${VERSION}.tar
else
./bits/bootstrap/mkdir DOCKER_ASSETS_DIR
[ $? -ne 0 ] && exit 1
DOCKER_IMAGE_FILE=$DOCKER_ASSETS_DIR/${NAME}.${VERSION}.tar
fi
if [[ -e $DOCKER_IMAGE_FILE.gz ]]; then
if [[ -e $DOCKER_IMAGE_FILE ]]; then
debug " -- Unzipped $DOCKER_IMAGE_FILE already exists, delete to force an unzip of $DOCKER_IMAGE_FILE.gz"
else
gunzip $DOCKER_IMAGE_FILE.gz
fi
fi
notify " -- Loading $IMAGE_NAME from $DOCKER_IMAGE_FILE"
SCRIPT_OUTPUT=$(docker load -i $DOCKER_IMAGE_FILE > $LOAD_OUTPUT 2>&1)
ERROR="Unable to load $IMAGE_NAME from $DOCKER_IMAGE_FILE due to ..." ./bits/bootstrap/failonerrors $? $LOAD_OUTPUT
[ $? -ne 0 ] && exit 1
if [[ -e $DOCKER_IMAGE_FILE.gz ]]; then
debug " -- $DOCKER_IMAGE_FILE already exists, deleting unzipped version"
else
debug " -- Zipping back up $DOCKER_IMAGE_FILE"
gzip $DOCKER_IMAGE_FILE
fi
rm -f $DOCKER_IMAGE_FILE
debug " -- DONE, Loading $IMAGE_NAME to $DOCKER_IMAGE_FILE"