From 1433b0c30e300858d11797f191d2e950dea94839 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Tue, 3 May 2022 22:43:59 -0400 Subject: [PATCH 1/3] feat: Determine the container name separator character by checking the Docker Compose API version at runtime --- Makefile | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 6808f97..d7656dd 100644 --- a/Makefile +++ b/Makefile @@ -1,24 +1,31 @@ -CONTAINER?=$(shell basename $(CURDIR))-php-1 -BUILDCHAIN?=$(shell basename $(CURDIR))-vite-1 +# Determine the docker compose API version to get the separator character +VERSION?=$(shell docker-compose -v) +ifneq (,$(findstring v2.,$(VERSION))) + SEPARATOR:=- +else + SEPARATOR:=_ +endif +CONTAINER?=$(shell basename $(CURDIR))$(SEPARATOR)php$(SEPARATOR)1 +BUILDCHAIN?=$(shell basename $(CURDIR))$(SEPARATOR)vite$(SEPARATOR)1 .PHONY: build clean composer craft dev npm pulldb restoredb nuke ssh up build: up - docker exec -it ${BUILDCHAIN} npm run build + docker exec -it $(BUILDCHAIN) npm run build clean: rm -f cms/composer.lock rm -rf cms/vendor/ rm -f buildchain/package-lock.json rm -rf buildchain/node_modules/ composer: up - docker exec -it ${CONTAINER} su-exec www-data composer \ + docker exec -it $(CONTAINER) su-exec www-data composer \ $(filter-out $@,$(MAKECMDGOALS)) craft: up - docker exec -it ${CONTAINER} su-exec www-data php craft \ + docker exec -it $(CONTAINER) su-exec www-data php craft \ $(filter-out $@,$(MAKECMDGOALS)) dev: up npm: up - docker exec -it ${BUILDCHAIN} npm \ + docker exec -it $(BUILDCHAIN) npm \ $(filter-out $@,$(MAKECMDGOALS)) pulldb: up cd scripts/ && ./docker_pull_db.sh @@ -29,9 +36,9 @@ nuke: clean docker-compose down -v docker-compose up --build --force-recreate ssh: - docker exec -it ${CONTAINER} su-exec www-data /bin/sh + docker exec -it $(CONTAINER) su-exec www-data /bin/sh up: - if [ ! "$$(docker ps -q -f name=${CONTAINER})" ]; then \ + if [ ! "$$(docker ps -q -f name=$(CONTAINER))" ]; then \ cp -n cms/example.env cms/.env; \ docker-compose up; \ fi From 032eccca79c948723090f6f8bab4153512738d2d Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Tue, 3 May 2022 22:44:13 -0400 Subject: [PATCH 2/3] docs: Remove reference to the Docker Compose v2 API --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 679b964..af94f4f 100644 --- a/README.md +++ b/README.md @@ -62,8 +62,6 @@ We use `--no-install` so that the composer packages for the root project are not You'll need [Docker desktop](https://www.docker.com/products/docker-desktop) for your platform installed to run devMode in local development -Ensure you're using the [Docker Compose API v2](https://stackoverflow.com/questions/69464001/docker-compose-container-name-use-dash-instead-of-underscore/70295720#70295720) for the `make` commands to all work properly. - Ensure no other local development environments are running that might have port conflicts, then: * Start up the site by typing `make dev` in terminal in the project's root directory (the first build will be somewhat lengthy) From 1e951a62fcbef880668d4ff6e3aae9ba039ee0a6 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Tue, 3 May 2022 22:44:25 -0400 Subject: [PATCH 3/3] chore: Version 2.5.11 --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d93fdf..22c623c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # nystudio107/craft Change Log +## 2.5.11 - 2022.05.03 +### Added +* Determine the container name separator character by checking the Docker Compose API version at runtime + ## 2.5.10 - 2022.05.02 ### Changed * Ignore `max-line-length` rule