refactor: do not pull image if it already exists

This commit is contained in:
Jose Diaz-Gonzalez
2022-12-18 17:52:32 -05:00
parent ca4be83e64
commit 654939afa7
2 changed files with 8 additions and 2 deletions

View File

@@ -26,8 +26,12 @@ trigger-git-git-from-image() {
echo "FROM $DOCKER_IMAGE" >>"$TMP_WORK_DIR/Dockerfile"
echo "LABEL com.dokku.docker-image-labeler/alternate-tags=[\\\"$DOCKER_IMAGE\\\"]" >>"$TMP_WORK_DIR/Dockerfile"
dokku_log_info1 "Pulling image"
"$DOCKER_BIN" image pull "$DOCKER_IMAGE"
if [[ "$(docker images -q "$DOCKER_IMAGE" 2>/dev/null)" == "" ]]; then
dokku_log_info1 "Pulling image"
"$DOCKER_BIN" image pull "$DOCKER_IMAGE"
else
dokku_log_info1 "Image exists on host, skipping pull"
fi
export DOKKU_BUILDING_FROM_IMAGE="$DOCKER_IMAGE"
plugn trigger git-from-directory "$APP" "$TMP_WORK_DIR" "$USER_NAME" "$USER_EMAIL"