Skip to content

Commit

Permalink
Allow make local to work without docker in path
Browse files Browse the repository at this point in the history
Signed-off-by: Tiger Kaovilai <[email protected]>
  • Loading branch information
kaovilai committed Jul 29, 2024
1 parent d9ca147 commit 8cc4e57
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,17 @@ else
GCR_IMAGE_TAGS ?= $(GCR_IMAGE):$(VERSION)
endif

# check buildx is enabled
# check buildx is enabled only if docker is in path
# macOS/Windows docker cli without Docker Desktop license: https://github.com/abiosoft/colima
# To add buildx to docker cli: https://github.com/abiosoft/colima/discussions/273#discussioncomment-2684502
ifeq ($(shell docker buildx inspect 2>/dev/null | awk '/Status/ { print $$2 }'), running)
ifeq ($(shell which docker &>/dev/null && docker buildx inspect 2>/dev/null | awk '/Status/ { print $$2 }'), running)
BUILDX_ENABLED ?= true
# if emulated docker cli from podman, assume enabled
# emulated docker cli from podman: https://podman-desktop.io/docs/migrating-from-docker/emulating-docker-cli-with-podman
# podman known issues:
# - on remote podman, such as on macOS,
# --output issue: https://github.com/containers/podman/issues/15922
else ifeq ($(shell cat $(shell which docker) | grep -c "exec podman"), 1)
else ifeq ($(shell which docker &>/dev/null && cat $(shell which docker) | grep -c "exec podman"), 1)
BUILDX_ENABLED ?= true
else
BUILDX_ENABLED ?= false
Expand Down Expand Up @@ -194,7 +194,12 @@ shell: build-dirs build-env

container:
ifneq ($(BUILDX_ENABLED), true)
$(error $(BUILDX_ERROR))
# TODO: PR debug, remove after
@echo "hello"
@echo wd $(shell which docker)
# echo wd $(shell where docker)
@echo path $(PATH)
# $(error $(BUILDX_ERROR))
endif
@docker buildx build --pull \
--output=type=$(BUILDX_OUTPUT_TYPE) \
Expand Down

0 comments on commit 8cc4e57

Please sign in to comment.