[FIX] Move Docker image check from start to initial_start so that

migrate command can also takes benefit from Docker images existence.
This commit is contained in:
Olivier DOSSMANN 2016-01-15 16:57:51 +01:00
parent 65c4a060d5
commit 5c50948a1f

View File

@ -259,6 +259,14 @@ test_initial_start() {
if ! test -f "$DOCKERFILE"; then if ! test -f "$DOCKERFILE"; then
error_and_quit "Docker file don't exists: ${DOCKERFILE}" error_and_quit "Docker file don't exists: ${DOCKERFILE}"
fi fi
# Build Gissmo Docker images if missing
if [[ "$($docker_cmd images -q gissmo:${GISSMO_VERSION} 2> /dev/null)" == "" ]]; then
cd $GISSMO_DIR
info "Building Docker images…"
$docker_cmd build -t gissmo:${GISSMO_VERSION} -f ${DOCKERFILE} . || error_and_quit "Failed to build Gissmo Docker container."
info "…done."
cd $CURRENT_DIR
fi
if test -z "$GISSMO_DOCKER_PORT"; then if test -z "$GISSMO_DOCKER_PORT"; then
error_and_quit "No Gissmo Docker container port given error_and_quit "No Gissmo Docker container port given
(GISSMO_DOCKER_PORT in config file)." (GISSMO_DOCKER_PORT in config file)."
@ -268,14 +276,6 @@ test_initial_start() {
initial_start() { initial_start() {
test_initial_start test_initial_start
# Build Gissmo Docker images if missing
if [[ "$($docker_cmd images -q gissmo:${GISSMO_VERSION} 2> /dev/null)" == "" ]]; then
cd $GISSMO_DIR
info "Building Docker images…"
$docker_cmd build -t gissmo:${GISSMO_VERSION} -f ${DOCKERFILE} . || error_and_quit "Failed to build Gissmo Docker container."
info "…done."
cd $CURRENT_DIR
fi
# Check postgreSQL Docker container exists and is launched. # Check postgreSQL Docker container exists and is launched.
test_postgresql_launched test_postgresql_launched
if [ $? -eq 1 ]; then if [ $? -eq 1 ]; then