Skip to content

Commit b111f49

Browse files
committed
Tooling: dynamic container name to remove confusion created by multiple forks - 2
1 parent 2984dc1 commit b111f49

File tree

3 files changed

+11
-17
lines changed

3 files changed

+11
-17
lines changed

Makefile

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ DOCKER_PHP=docker-compose run --rm php
1515
DOCKER_NODE=docker-compose run --rm -w /app node
1616
endif
1717

18-
CONTAINER_NAME=$$(echo $$(pwd) | tr / _)
19-
18+
CONTAINER_NAME=$$(echo $$(pwd) | tr / _ | cut -c 2-)
19+
UID=$(shell id -u)
2020

2121
all:
2222
@echo "the following commands are available:"
@@ -36,10 +36,10 @@ check-style: php-cs-fixer.phar
3636
PHP_CS_FIXER_IGNORE_ENV=1 ./php-cs-fixer.phar fix src/ --diff --dry-run
3737

3838
cli:
39-
docker-compose exec --user=$(shell id -u) php bash
39+
COMPOSE_PROJECT_NAME=$(CONTAINER_NAME) docker-compose exec --user=$(UID) php bash
4040

4141
cli_root:
42-
docker-compose exec --user="root" php bash
42+
COMPOSE_PROJECT_NAME=$(CONTAINER_NAME) docker-compose exec --user="root" php bash
4343

4444
fix-style: php-cs-fixer.phar
4545
$(DOCKER_PHP) vendor/bin/indent --tabs composer.json
@@ -90,11 +90,13 @@ coverage: .php-openapi-covA .php-openapi-covB
9090
.php-openapi-covB:
9191
grep -rhPo '^class \w+' src/spec/ | awk '{print $$2}' |grep -v '^Type$$' | sort > $@
9292

93-
docker-compose.override.yml: docker-compose.override.dist.yml
94-
test -f $@ || cp $< $@
93+
build-docker:
94+
COMPOSE_PROJECT_NAME=$(CONTAINER_NAME) docker-compose build
9595

96-
start-docker: docker-compose.override.yml
97-
CONTAINER_NAME=$(CONTAINER_NAME) docker-compose up -d
96+
start-docker:
97+
COMPOSE_PROJECT_NAME=$(CONTAINER_NAME) docker-compose up -d
9898

99-
.PHONY: all check-style fix-style install test lint coverage
99+
stop-docker:
100+
COMPOSE_PROJECT_NAME=$(CONTAINER_NAME) docker-compose down --remove-orphans
100101

102+
.PHONY: all check-style fix-style install test lint coverage build-docker start-docker stop-docker

docker-compose.override.dist.yml

Lines changed: 0 additions & 4 deletions
This file was deleted.

docker-compose.override.yml

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)