Skip to content

Commit 50eb69b

Browse files
authored
chore: alias to docker compose command (#1921)
## What kind of change does this PR introduce? chore: support both `docker compose` or `docker-compose` command ## What is the current behavior? no issue link ## What is the new behavior? before this commit, dev can have error if install docker-compose as plugin. After this commit, dev can run `make docker-x` without errros ## Additional context no
1 parent 37e2349 commit 50eb69b

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

Makefile

+17-11
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ ifdef RELEASE_VERSION
66
FLAGS=-ldflags "-X github.com/supabase/auth/internal/utilities.Version=v$(RELEASE_VERSION)" -buildvcs=false
77
endif
88

9+
ifneq ($(shell docker compose version 2>/dev/null),)
10+
DOCKER_COMPOSE=docker compose
11+
else
12+
DOCKER_COMPOSE=docker-compose
13+
endif
14+
915
DEV_DOCKER_COMPOSE:=docker-compose-dev.yml
1016

1117
help: ## Show this help.
@@ -62,26 +68,26 @@ generate: dev-deps
6268
go generate ./...
6369

6470
dev: ## Run the development containers
65-
docker-compose -f $(DEV_DOCKER_COMPOSE) up
71+
${DOCKER_COMPOSE} -f $(DEV_DOCKER_COMPOSE) up
6672

6773
down: ## Shutdown the development containers
6874
# Start postgres first and apply migrations
69-
docker-compose -f $(DEV_DOCKER_COMPOSE) down
75+
${DOCKER_COMPOSE} -f $(DEV_DOCKER_COMPOSE) down
7076

7177
docker-test: ## Run the tests using the development containers
72-
docker-compose -f $(DEV_DOCKER_COMPOSE) up -d postgres
73-
docker-compose -f $(DEV_DOCKER_COMPOSE) run auth sh -c "make migrate_test"
74-
docker-compose -f $(DEV_DOCKER_COMPOSE) run auth sh -c "make test"
75-
docker-compose -f $(DEV_DOCKER_COMPOSE) down -v
78+
${DOCKER_COMPOSE} -f $(DEV_DOCKER_COMPOSE) up -d postgres
79+
${DOCKER_COMPOSE} -f $(DEV_DOCKER_COMPOSE) run auth sh -c "make migrate_test"
80+
${DOCKER_COMPOSE} -f $(DEV_DOCKER_COMPOSE) run auth sh -c "make test"
81+
${DOCKER_COMPOSE} -f $(DEV_DOCKER_COMPOSE) down -v
7682

7783
docker-build: ## Force a full rebuild of the development containers
78-
docker-compose -f $(DEV_DOCKER_COMPOSE) build --no-cache
79-
docker-compose -f $(DEV_DOCKER_COMPOSE) up -d postgres
80-
docker-compose -f $(DEV_DOCKER_COMPOSE) run auth sh -c "make migrate_dev"
81-
docker-compose -f $(DEV_DOCKER_COMPOSE) down
84+
${DOCKER_COMPOSE} -f $(DEV_DOCKER_COMPOSE) build --no-cache
85+
${DOCKER_COMPOSE} -f $(DEV_DOCKER_COMPOSE) up -d postgres
86+
${DOCKER_COMPOSE} -f $(DEV_DOCKER_COMPOSE) run auth sh -c "make migrate_dev"
87+
${DOCKER_COMPOSE} -f $(DEV_DOCKER_COMPOSE) down
8288

8389
docker-clean: ## Remove the development containers and volumes
84-
docker-compose -f $(DEV_DOCKER_COMPOSE) rm -fsv
90+
${DOCKER_COMPOSE} -f $(DEV_DOCKER_COMPOSE) rm -fsv
8591

8692
format:
8793
gofmt -s -w .

0 commit comments

Comments
 (0)