-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
40 lines (32 loc) · 1.42 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
DOCKERHUB_REPO := $(shell cat ./docker_repo.var)
DOCKER_TAG ?= $(shell git rev-parse --short HEAD)
DOCKER_IMAGE := $(DOCKERHUB_REPO):$(DOCKER_TAG)
DOCKER_IMAGE_LATEST := $(DOCKERHUB_REPO):latest
DOCKER_COMPOSE_CMD := $(shell if command -v docker-compose > /dev/null; then echo "docker-compose"; else echo "docker compose"; fi)
####
# `DOCKER_IMAGE_BRANCH` tag is the git tag for the commit if it exists, else the branch on which the commit exists
DOCKER_IMAGE_BRANCH := $(DOCKERHUB_REPO):$(shell git describe --exact-match --tags 2> /dev/null || git symbolic-ref --short HEAD | sed 's/[^[:alnum:]\.\_\-]/-/g')
.PHONY: build
build:
$(DOCKER_COMPOSE_CMD) -f ./server/conf/docker/docker-compose.yml build
.PHONY: build-full
build-full:
docker build -t $(DOCKER_IMAGE) --target production -f ./server/conf/docker/Dockerfile .
docker tag $(DOCKER_IMAGE) $(DOCKER_IMAGE_BRANCH) # Note: Special chars replaced with dashes
.PHONY: publish
publish:
docker push $(DOCKER_IMAGE)
docker push $(DOCKER_IMAGE_BRANCH)
.PHONY: publish-latest
publish-latest:
docker tag $(DOCKER_IMAGE) $(DOCKER_IMAGE_LATEST)
docker push $(DOCKER_IMAGE_LATEST)
.PHONY: start
start:
$(DOCKER_COMPOSE_CMD) -f server/conf/docker/docker-compose-dev.all.debug.yml up
.PHONY: stop
stop:
$(DOCKER_COMPOSE_CMD) -f server/conf/docker/docker-compose-dev.all.debug.yml down
.PHONY: stop-full
stop-v:
$(DOCKER_COMPOSE_CMD) -f server/conf/docker/docker-compose-dev.all.debug.yml down -v