-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
59 lines (46 loc) · 1.7 KB
/
Copy pathMakefile
File metadata and controls
59 lines (46 loc) · 1.7 KB
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
DOCKERHUB_REPO := taccwma/core-cms
DOCKER_TAG ?= $(shell git rev-parse --short HEAD)
DOCKER_IMAGE := $(DOCKERHUB_REPO):$(DOCKER_TAG)
DOCKER_IMAGE_LATEST := $(DOCKERHUB_REPO):latest
# WARNING: Using `docker-compose` is deprecated
DOCKER_COMPOSE_CMD := $(shell if command -v docker-compose > /dev/null; then echo "docker-compose"; else echo "docker compose"; fi)
# NOTE: The `DOCKER_IMAGE_BRANCH` tag is the git tag for the commit if it exists, else the branch on which the commit exists.
# NOTE: Special characters in `DOCKER_IMAGE_BRANCH` are replaced with dashes.
DOCKER_IMAGE_BRANCH := $(DOCKERHUB_REPO):$(shell git describe --exact-match --tags 2> /dev/null || git symbolic-ref --short HEAD | sed 's/[^[:alnum:]\.\_\-]/-/g')
BUILD_ID := $(shell git describe --tags 2>/dev/null || git rev-parse --short HEAD)
.PHONY: build
build:
$(DOCKER_COMPOSE_CMD) -f ./docker-compose.yml build
.PHONY: build-full
build-full:
docker build -t $(DOCKER_IMAGE) \
--target production \
--build-arg BUILD_ID="$(BUILD_ID)" \
-f ./Dockerfile .
docker tag $(DOCKER_IMAGE) $(DOCKER_IMAGE_BRANCH)
.PHONY: example
example:
$(DOCKER_COMPOSE_CMD) -f ./docker-compose.example.yml up
.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 docker-compose.dev.yml up $(ARGS)
.PHONY: stop
stop:
$(DOCKER_COMPOSE_CMD) -f docker-compose.dev.yml down $(ARGS)
.PHONY: stop-v
stop-v:
$(MAKE) stop ARGS="--volumes"
.PHONY: clean
clean:
$(DOCKER_COMPOSE_CMD) -f docker-compose.dev.yml down -v --rmi all
.PHONY: setup
setup:
./bin/setup-cms.sh