-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
93 lines (62 loc) · 2.23 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
.PHONY: *
OPTS=list
ifneq (,$(wildcard ./.env))
include .env
export
endif
ifeq ($(origin TAGNAME),undefined)
TAG_NAME=staging-build
else
TAG_NAME=${TAGNAME}
endif
DOCKER_RUN=docker compose run -it --rm aspiresync
build-local: build-prod build-dev ## Builds all the local containers for prod and dev
build-all: build-prod-aws build-dev-aws ## Builds all containers by way of building the AWS containers
push-all: push push-dev ## Pushes all prod and dev containers to AWS
build-prod:
docker build --platform=linux/amd64,linux/arm64 --target prodbuild -t aspirepress/aspiresync:latest -t aspirepress/aspiresync:$(TAG_NAME) -f ./docker/Dockerfile .
build-dev:
docker build --target devbuild -t aspiresync-dev -f ./docker/Dockerfile .
docker build --target devbuild -t aspiresync-dev-build -f ./docker/Dockerfile .
build-prod-aws: build-prod
docker tag aspirepress/aspiresync:$(TAG_NAME) ${AWS_ECR_REGISTRY}:$(TAG_NAME)
docker tag aspirepress/aspiresync:latest ${AWS_ECR_REGISTRY}:latest
build-dev-aws: build-dev
docker tag aspiresync-dev-build ${AWS_ECR_REGISTRY}:dev-build
docker tag aspiresync-dev-build ${AWS_ECR_REGISTRY}:`git rev-parse --short HEAD`
run:
${DOCKER_RUN} bash
composer-install:
${DOCKER_RUN} composer install
composer-update:
${DOCKER_RUN} composer update
init: down build-dev up composer-install
down:
docker compose down --remove-orphans
up:
docker compose up -d
check: csfix cs quality test
quality:
${DOCKER_RUN} ./vendor/bin/phpstan --memory-limit=2G
test:
${DOCKER_RUN} ./vendor/bin/phpunit
unit:
${DOCKER_RUN} ./vendor/bin/phpunit --testsuite=unit
functional:
${DOCKER_RUN} ./vendor/bin/phpunit --testsuite=functional
cs:
${DOCKER_RUN} ./vendor/bin/phpcs
csfix:
${DOCKER_RUN} ./vendor/bin/phpcbf
authenticate: authenticate-aws docker-login-aws
reauthenticate: authenticate
authenticate-aws:
aws sso login --profile ${AWS_PROFILE}
docker-login-aws:
aws ecr get-login-password --region us-east-2 --profile ${AWS_PROFILE} | docker login --username AWS --password-stdin ${AWS_ECR_ENDPOINT}
push:
docker push ${AWS_ECR_REGISTRY}:$(TAG_NAME)
docker push ${AWS_ECR_REGISTRY}:latest
push-dev:
docker push ${AWS_ECR_REGISTRY}:dev-build
docker push ${AWS_ECR_REGISTRY}:`git rev-parse --short HEAD`