-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
67 lines (49 loc) · 2.53 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
SRC_FILES := $(shell find . -name "*.go")
DOCKER_REPOSITORY := jnorwood
CONSUMERS_IMAGE := hashbash-consumers-go
MIGRATE_IMAGE := hashbash-migrate
WEBAPP_IMAGE := hashbash-webapp-go
##
# Build targets
##
build: hashbash-cli hashbash-engine hashbash-webapp
:
hashbash-cli: $(SRC_FILES)
go build -ldflags "-X main.version=$(shell git describe)" -o hashbash-cli github.com/norwoodj/hashbash-backend-go/cmd/hashbash-cli
hashbash-engine: $(SRC_FILES)
go build -ldflags "-X main.version=$(shell git describe)" -o hashbash-engine github.com/norwoodj/hashbash-backend-go/cmd/hashbash-engine
hashbash-webapp: $(SRC_FILES)
go build -ldflags "-X main.buildTimestamp=$(shell date --utc --iso-8601=seconds) -X main.gitRevision=$(shell git rev-parse HEAD) -X main.version=$(shell git describe)" -o hashbash-webapp github.com/norwoodj/hashbash-backend-go/cmd/hashbash-webapp
deb:
debuild
images: engine webapp migrate
engine:
docker-compose -f docker/docker-compose-hashbash-deps.yaml -f docker/docker-compose-hashbash.yaml build hashbash-engine
touch engine
webapp:
docker-compose -f docker/docker-compose-hashbash-deps.yaml -f docker/docker-compose-hashbash.yaml build hashbash-webapp
touch webapp
migrate:
docker-compose -f docker/docker-compose-hashbash-deps.yaml build migrate
touch migrate
release:
./scripts/release.sh
push: images
docker tag $(DOCKER_REPOSITORY)/$(CONSUMERS_IMAGE) $(DOCKER_REPOSITORY)/$(CONSUMERS_IMAGE):$(shell git tag -l | tail -n 1)
docker tag $(DOCKER_REPOSITORY)/$(WEBAPP_IMAGE) $(DOCKER_REPOSITORY)/$(WEBAPP_IMAGE):$(shell git tag -l | tail -n 1)
docker tag $(DOCKER_REPOSITORY)/$(MIGRATE_IMAGE) $(DOCKER_REPOSITORY)/$(MIGRATE_IMAGE):$(shell git tag -l | tail -n 1)
docker push $(DOCKER_REPOSITORY)/$(CONSUMERS_IMAGE):$(shell git tag -l | tail -n 1)
docker push $(DOCKER_REPOSITORY)/$(WEBAPP_IMAGE):$(shell git tag -l | tail -n 1)
docker push $(DOCKER_REPOSITORY)/$(MIGRATE_IMAGE):$(shell git tag -l | tail -n 1)
down:
docker-compose -f docker/docker-compose-hashbash-deps.yaml -f docker/docker-compose-hashbash.yaml down --volumes
schema:
docker-compose -f docker/docker-compose-hashbash-deps.yaml run --rm migrate
new-schema:
docker-compose -f docker/docker-compose-hashbash-deps.yaml run --entrypoint /migrate --rm migrate create -dir versions -ext sql $(SCHEMA_NAME)
run-deps:
docker-compose -f docker/docker-compose-hashbash-deps.yaml up
run:
docker-compose -f docker/docker-compose-hashbash-deps.yaml -f docker/docker-compose-hashbash.yaml up
clean:
rm -vf hashbash-cli hashbash-engine hashbash-webapp engine webapp migrate