Skip to content

Commit 181f5fa

Browse files
tillmannrngabor84
andcommitted
Create docker-compose file
EME-1254 Co-authored-by: Gabor Nemeth <negabor@gmail.com>
1 parent 1ccea73 commit 181f5fa

2 files changed

Lines changed: 20 additions & 22 deletions

File tree

Makefile

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
DOCKER = docker
2-
CONTAINER = php-suite-api
3-
41
ifndef TESTMETHOD
52
FILTERARGS=
63
else
@@ -14,38 +11,32 @@ help: ## help page
1411
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/\(.*\):.*##[ \t]*/ \1 ## /' | column -t -s '##'
1512
@echo
1613

17-
all: destroy update build run packages ## destroy update build run packages
14+
all: destroy update build up packages ## destroy update build run packages
1815

1916
destroy: ## remove container
20-
-$(DOCKER) rm -f $(CONTAINER)
17+
docker-compose down
2118

22-
build: ## build comtainer
23-
$(DOCKER) build --no-cache -t $(CONTAINER) .
19+
build: ## build container
20+
@docker-compose build
2421

25-
run: ## run
26-
$(DOCKER) run -d -v "$$PWD":/var/www/html/ --rm --name=$(CONTAINER) -h $(CONTAINER).ett.local $(CONTAINER)
22+
up: ## run
23+
docker-compose up -d
24+
## $(DOCKER) run -d -v "$$PWD":/var/www/html/ --rm --name=$(CONTAINER) -h $(CONTAINER).ett.local $(CONTAINER)
2725

2826
stop: ## stop container
29-
-$(DOCKER) rm -f $(CONTAINER)
27+
docker-compose stop
3028

31-
restart: stop run ## restart container and run
29+
restart: stop up ## restart container and run
3230

3331
ssh: sh ## get a shell in the container (alias for sh)
3432
sh: ## get a shell in the container
35-
$(DOCKER) exec -it $(CONTAINER) /bin/bash
33+
@docker-compose exec web /bin/bash
3634

3735
logs: ## show logs
38-
$(DOCKER) logs --follow $(CONTAINER)
36+
@docker-compose logs -f web
3937

4038
test: ## run tests
41-
$(DOCKER) exec $(CONTAINER) bash -c "cd /var/www/html && vendor/bin/phpunit -c test/phpunit.xml $(FILTERARGS) $(TESTFILE)"
39+
docker-compose exec web /bin/bash -l -c "cd /var/www/html && vendor/bin/phpunit -c test/phpunit.xml $(FILTERARGS) $(TESTFILE)"
4240

4341
packages: ## install packages
44-
$(DOCKER) exec -i -t $(CONTAINER) /bin/bash -l -c "composer install 2>&1"
45-
46-
pu: packages-update ## update packages (alias for packages-update)
47-
packages-update: ## update packages
48-
$(DOCKER) exec -i -t $(CONTAINER) /bin/bash -l -c "composer update 2>&1"
49-
50-
update: ## update container
51-
$(DOCKER) pull $(shell awk '/^FROM/ { print $$2; exit }' Dockerfile)
42+
docker-compose run --rm web composer install

docker-compose.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
version: '3'
2+
services:
3+
web:
4+
build: ./
5+
volumes:
6+
- ".:/var/www/html/:delegated"
7+
- "~/.composer/docker-cache/:/root/.composer:cached"

0 commit comments

Comments
 (0)