Skip to content

Commit d415463

Browse files
committed
partial fix for dbstack build -u
1 parent 1b7b847 commit d415463

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

bin/dbstack

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -209,10 +209,18 @@ build() {
209209

210210
if [ ${PULL_IMAGES} = 'true' ]; then
211211
echo "[$(date)] Pulling base Docker images..."
212-
# @todo fix this: it won't work any more since we moved to using env vars
213-
IMAGES=$(find . -name Dockerfile | xargs fgrep -h 'FROM' | sort -u | sed 's/FROM //g')
214-
for IMAGE in $IMAGES; do
215-
docker pull $IMAGE
212+
213+
for DOCKERFILE in $(find . -name Dockerfile); do
214+
IMAGE=$(fgrep -h 'FROM' "${DOCKERFILE}" | sed 's/FROM //g')
215+
if [[ "${IMAGE}" == *'${base_image_version}'* ]]; then
216+
# @todo resolve the `base_image_version` dockerfile arg by resolving the source env var - run eg. docker-compose config
217+
DEFAULT_BASE_IMAGE=$(fgrep -h 'ARG base_image_version=' "${DOCKERFILE}" | sed 's/ARG base_image_version=//g')
218+
IMAGE=${IMAGE/\$\{base_image_version\}/$DEFAULT_BASE_IMAGE}
219+
220+
printf "\e[31mWARNING: pulling base image ${IMAGE} for container ${DOCKERFILE} which might have been overwritten via env var...\e[0m\n" >&2
221+
fi
222+
223+
docker pull "${IMAGE}"
216224
done
217225
fi
218226

@@ -480,7 +488,7 @@ case "${COMMAND}" in
480488
;;
481489

482490
config)
483-
${DOCKER_COMPOSE_CMD} ${VERBOSITY} config ${2}
491+
${DOCKER_COMPOSE_CMD} ${VERBOSITY} config
484492
;;
485493

486494
dbconsole)

0 commit comments

Comments
 (0)