Skip to content

Commit

Permalink
Merge pull request #15 from devilbox/improve-pull-image
Browse files Browse the repository at this point in the history
Allow for shell variables in docker FROM tag
  • Loading branch information
cytopia authored Nov 7, 2022
2 parents 72d40dd + d77607c commit 57ff4e6
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Makefile.docker
Original file line number Diff line number Diff line change
Expand Up @@ -198,15 +198,18 @@ docker-load:
# -------------------------------------------------------------------------------------------------
.PHONY: docker-pull-base-image
_DOCKER_PULL_BASE_IMAGES_FOUND = $(shell grep FROM $(DIR)/$(FILE) | sed 's/^FROM\s*//g' | sed 's/\s.*$$//g' | sort -u )
DOCKER_PULL_VARIABLES = VERSION=$(VERSION)
docker-pull-base-image:
@echo "################################################################################"
@echo "# Pulling Base Image (platform: $(ARCH))"
@echo "################################################################################"
@echo "Docker File: $(DIR)/$(FILE)"
@echo "Images Found: $(_DOCKER_PULL_BASE_IMAGES_FOUND)"
@echo "Images Ignore: $(DOCKER_PULL_BASE_IMAGES_IGNORE)"
@if [ -n "$(DOCKER_PULL_VARIABLES)" ]; then for e in "$(DOCKER_PULL_VARIABLES)";do export "$${e}";done; fi; echo "Images Found: $(_DOCKER_PULL_BASE_IMAGES_FOUND)"
@if [ -n "$(DOCKER_PULL_VARIABLES)" ]; then for e in "$(DOCKER_PULL_VARIABLES)";do export "$${e}";done; fi; echo "Images Ignore: $(DOCKER_PULL_BASE_IMAGES_IGNORE)"
@echo
@echo $(_DOCKER_PULL_BASE_IMAGES_FOUND) | sed 's/\s/\n/g' | while read -r line; do \
@# These variables will be exported to the shell
@if [ -n "$(DOCKER_PULL_VARIABLES)" ]; then for e in "$(DOCKER_PULL_VARIABLES)";do export "$${e}";done; fi; \
echo $(_DOCKER_PULL_BASE_IMAGES_FOUND) | sed 's/\s/\n/g' | while read -r line; do \
if echo "$(DOCKER_PULL_BASE_IMAGES_IGNORE)" | grep -F "$${line}" >/dev/null; then \
continue; \
fi; \
Expand Down

0 comments on commit 57ff4e6

Please sign in to comment.