Skip to content

Commit

Permalink
Default to docker compose if available but with fallback to the old d…
Browse files Browse the repository at this point in the history
…ocker-compose command or the podman-compose if using podman.
  • Loading branch information
jonasbardino committed Mar 21, 2024
1 parent 0288f9b commit 3a3f91b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@ SHELL=/bin/bash
DOCKER_BUILDKIT=1
# NOTE: dynamic lookup with docker as default and fallback to podman
DOCKER = $(shell which docker || which podman)
# if compose is not found, try to use it as plugin, eg. RHEL8
DOCKER_COMPOSE = $(shell which docker-compose || which podman-compose || echo 'docker compose')
# if docker compose plugin is not available, try old docker-compose/podman-compose
ifeq (, $(shell ${DOCKER} help|grep compose))
DOCKER_COMPOSE = $(shell which docker-compose || which podman-compose)
else
DOCKER_COMPOSE = 'docker compose'
endif
$(echo ${DOCKER_COMPOSE} >/dev/null)

define DOCKER_COMPOSE_SHARED_HEADER
Expand Down Expand Up @@ -38,6 +42,7 @@ endif
all: init dockerbuild

init: initbuild initdirs initcomposevars
@echo "using ${DOCKER_COMPOSE} as compose command"

initbuild:
ifeq (,$(wildcard ./Dockerfile))
Expand Down

0 comments on commit 3a3f91b

Please sign in to comment.