refactor: do not pull image if it already exists
This commit is contained in:
@@ -136,6 +136,8 @@ In the above example, Dokku will build the app as if the repository contained _o
|
||||
FROM dokku/node-js-getting-started:latest
|
||||
```
|
||||
|
||||
If the specified image already exists on the Dokku host, it will not be pulled again, though this behavior may be changed using [build phase docker-options](/docs/advanced-usage/docker-options.md).
|
||||
|
||||
Triggering a build with the same arguments multiple times will result in Dokku exiting `0` early as there will be no changes detected. If the image tag is reused but the underlying image is different, it is recommended to use the image digest instead of the tag. This can be retrieved via the following command:
|
||||
|
||||
```shell
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user