-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathMakefile
More file actions
48 lines (38 loc) · 1.28 KB
/
Makefile
File metadata and controls
48 lines (38 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# Check for docker/podman
DOCKER := $(shell command -v podman 2> /dev/null || command -v docker 2> /dev/null)
# Check for docker-compose/podman-compose
DOCKER_COMPOSE := $(shell command -v podman-compose 2> /dev/null || command -v docker-compose 2> /dev/null)
COMPOSE_FILE := $(PWD)/deploy/dev/docker-compose.yml
.PHONY: info
info:
ifeq ($(DOCKER),)
@echo "Neither docker nor podman is installed."
exit 1
else
@echo "Using $(DOCKER)"
endif
ifeq ($(DOCKER_COMPOSE),)
@echo "Neither docker-compose nor podman-compose is installed."
exit 1
else
@echo "Using $(DOCKER_COMPOSE) with $(COMPOSE_FILE)"
endif
# Start the containers
.PHONY: compose-up
compose-up:
$(DOCKER_COMPOSE) --file $(COMPOSE_FILE) up -d
# Stop the containers
.PHONY: compose-down
compose-down:
$(DOCKER_COMPOSE) --file $(COMPOSE_FILE) down
# Get container ID
.PHONY: $(FPM_ID)
FPM_ID = $(shell $(DOCKER) ps | grep 'quay.io/kissj/php-ubi' | awk '{print $$1}')
.PHONY: composer-install
composer-install:
$(DOCKER) exec -it -u root $(FPM_ID) sh -c "COMPOSER_ALLOW_SUPERUSER=1 composer install --no-interaction"
.PHONY: migrate
migrate:
$(DOCKER) exec -it -u root $(FPM_ID) sh -c "COMPOSER_ALLOW_SUPERUSER=1 composer phinx:migrate --no-interaction"
dev-up: info compose-up composer-install migrate
dev-down: info compose-down