Skip to content

Commit

Permalink
Support Docker Compose V2 in Makefile (#900)
Browse files Browse the repository at this point in the history
Since Docker Compose is installed as a plugin in v2 the
binary `docker-compose` is not always available.
The makefile will use `docker compose` in that case.
  • Loading branch information
bjosv authored Apr 21, 2024
1 parent 2abd8c1 commit 46861ba
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
.DEFAULT_GOAL := build

DOCKER_COMPOSE := $(if $(shell which docker-compose),docker-compose,docker compose)

.PHONY: build
build:
go build .
Expand All @@ -11,18 +13,18 @@ docker-all: docker-env-up docker-test docker-env-down

.PHONY: docker-env-up
docker-env-up:
docker-compose -f contrib/docker-compose-for-tests.yml up -d
$(DOCKER_COMPOSE) -f contrib/docker-compose-for-tests.yml up -d


.PHONY: docker-env-down
docker-env-down:
docker-compose -f contrib/docker-compose-for-tests.yml down
$(DOCKER_COMPOSE) -f contrib/docker-compose-for-tests.yml down


.PHONY: docker-test
docker-test:
docker-compose -f contrib/docker-compose-for-tests.yml up -d
docker-compose -f contrib/docker-compose-for-tests.yml run --rm tests bash -c 'make test'
$(DOCKER_COMPOSE) -f contrib/docker-compose-for-tests.yml up -d
$(DOCKER_COMPOSE) -f contrib/docker-compose-for-tests.yml run --rm tests bash -c 'make test'



Expand Down

0 comments on commit 46861ba

Please sign in to comment.