Skip to content

Commit

Permalink
Merge pull request #25 from devilbox/docker-base-image
Browse files Browse the repository at this point in the history
Eval exit code of wrong $(shell) cmds
  • Loading branch information
cytopia authored Dec 4, 2022
2 parents 0690177 + d8cb761 commit c488963
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion Makefile.docker
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,13 @@ docker-load:
# Helper Targets
# -------------------------------------------------------------------------------------------------
.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_BASE_IMAGES_FOUND = $(shell \
if [ ! -f "$(DIR)/$(FILE)" ]; then \
echo "Error, Dockerfile not found in: $(DIR)/$(FILE)" >&2; \
exit 1; \
fi; \
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 "################################################################################"
Expand All @@ -209,6 +215,9 @@ docker-pull-base-image:
@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
@if [ "$(.SHELLSTATUS)" != "0" ]; then \
exit 1; \
fi
# 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 \
Expand Down

0 comments on commit c488963

Please sign in to comment.