-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
48 lines (40 loc) · 1.73 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
# Add any other binaries to build here, seperated by a space
TARGETS := server migrate
INFO_STR=[INFO]
.PHONY: dev dev-force-rebuild dev-cleanup dev-frontend test build clean
dev: dev-frontend
@echo $(INFO_STR) starting dev environment...
@docker-compose -f deploy/docker-compose.default.yml -f deploy/docker-compose.dev.yml up
dev-force-rebuild: dev-frontend
@echo $(INFO_STR) rebuilding dev environment...
@docker-compose -f deploy/docker-compose.default.yml -f deploy/docker-compose.dev.yml up --build --force-recreate
dev-cleanup:
@echo $(INFO_STR) removing dev environment...
@docker-compose -f deploy/docker-compose.default.yml -f deploy/docker-compose.dev.yml rm --stop
dev-frontend:
@echo $(INFO_STR) installing frontend dependencies
@npm install
@gulp dev &
test:
@echo $(INFO_STR) starting test environment...
@# Because of how docker handles .env files (different than env_files‽), we
@# need to run the docker-compose command inside the directory with our
@# test .env file.
@#
@# Why is this one big command? Make runs separate commands in their own
@# subshell (oof @252), so if they weren't together then the following command
@# would no longer in the correct directory after cding.
@cd deploy/test && \
docker-compose -f ../docker-compose.default.yml -f docker-compose.test.yml up -d --build && \
docker-compose -f ../docker-compose.default.yml -f docker-compose.test.yml exec bm-app go test -v /bm-app/...
@# Also, see comment above for why we don't need to cd out
build:
@for target in $(TARGETS); do \
echo $(INFO_STR) building binary \"$$target\"; \
go build -o bin/$$target ./cmd/$$target; \
done
clean:
@echo $(INFO_STR) cleaning dependencies and removing binaries...
@go clean
@go mod tidy
@rm -rf ./bin