-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile
122 lines (100 loc) · 2.89 KB
/
Makefile
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
APP_VERSION = $$(git describe --tags `git rev-list --tags --max-count=1` | cut -c 2- ) # Get latest tag without the "v" prefix
IMAGE ?= 68publishers/cmp
start:
docker compose --profile web up -d
@echo "visit http://localhost:8888"
start-worker:
docker compose --profile worker up -d
stop:
docker compose --profile web --profile worker stop
stop-worker:
docker compose --profile worker stop
down:
docker compose --profile web --profile worker down
restart:
make stop
make stop-worker
make start
make start-worker
cache:
docker exec -it cmp-app bin/console
cache-clear:
rm -rf var/cache/*
rm -rf var/log/*
rm -rf var/mail-panel-latte
db-clear:
rm -rf var/postgres-data/*
build.local.%:
@echo "building a local image $(IMAGE):app-$* ..."
@docker build -t $(IMAGE):app-$* -f ./docker/build/Dockerfile --target app .
@echo "done"
@echo "building a local image $(IMAGE):worker-$* ..."
@docker build -t $(IMAGE):worker-$* -f ./docker/build/Dockerfile --target worker .
@echo "done"
build.multiarch.%:
@docker buildx inspect multi_arch_builder > /dev/null 2>&1; \
if [ $$? -ne 0 ]; then \
echo "builder multi_arch_builder does not exist, initialization starting..."; \
docker buildx create --name multi_arch_builder --driver docker-container --bootstrap; \
echo "done"; \
else \
echo "builder multi_arch_builder does exist, skipping initialization."; \
fi
@echo "building multiplatform [linux/arm64/v8, linux/amd64] image $(IMAGE):app-$* ..."
@docker buildx build \
-f ./docker/build/Dockerfile \
--pull \
--push \
--builder multi_arch_builder \
--platform linux/arm64/v8,linux/amd64 \
--provenance=false \
--target app \
-t ${IMAGE}:app-$* \
.
@echo "done"
@echo "building multiplatform [linux/arm64/v8, linux/amd64] image $(IMAGE):worker-$* ..."
@docker buildx build \
-f ./docker/build/Dockerfile \
--pull \
--push \
--builder multi_arch_builder \
--platform linux/arm64/v8,linux/amd64 \
--provenance=false \
--target worker \
-t $(IMAGE):worker-$* \
.
@echo "done"
install:
make cache-clear
make install-composer
make install-assets
# Duplicity with init
make data-migration
install-composer:
docker exec -it cmp-app composer install --no-interaction --no-ansi --prefer-dist --no-progress --optimize-autoloader
install-assets:
docker exec -it cmp-app yarn install --no-progress --non-interactive
docker exec -it cmp-app yarn run encore prod
init:
make stop
make db-clear
make start
make install
make data
make start-worker
data:
make data-migration
docker exec -it cmp-app bin/console doctrine:fixtures:load --no-interaction
data-migration:
docker exec -it cmp-app bin/console migrations:migrate --no-interaction
.PHONY: tests
tests:
docker exec cmp-app vendor/bin/tester -C -s ./tests
qa:
@echo "not implemented" >&2
cs:
docker exec -it cmp-app ./vendor/bin/php-cs-fixer fix -v
coverage:
@echo "not implemented" >&2
version:
@echo ${APP_VERSION}