-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
47 lines (39 loc) · 1.62 KB
/
Makefile
File metadata and controls
47 lines (39 loc) · 1.62 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
DOCKERHUB_REPO := $(shell cat ./docker_repo.var)
GIT_TAG:= $(shell cat ./git_tag.var)
DOCKER_TAG ?= $(shell git rev-parse --short HEAD)
DOCKER_IMAGE := $(DOCKERHUB_REPO):$(DOCKER_TAG)
DOCKER_IMAGE_LATEST := $(DOCKERHUB_REPO):latest
NGROK_ENV_FILE = ./server/conf/env_files/ngrok.env
ifeq ("$(wildcard $(NGROK_ENV_FILE))","")
NGROK_ENV_FILE = ./server/conf/env_files/ngrok.sample.env
endif
####
# `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')
ifdef GIT_TAG
DOCKER_IMAGE_BRANCH := $(DOCKERHUB_REPO):$(GIT_TAG)
endif
.PHONY: build
build:
docker compose -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 --env-file $(NGROK_ENV_FILE) -f server/conf/docker/docker-compose-dev.all.debug.yml up
.PHONY: stop
stop:
docker compose --env-file $(NGROK_ENV_FILE) -f server/conf/docker/docker-compose-dev.all.debug.yml down
.PHONY: stop-full
stop-v:
docker compose --env-file $(NGROK_ENV_FILE) -f server/conf/docker/docker-compose-dev.all.debug.yml down -v