-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
46 lines (33 loc) · 959 Bytes
/
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
.PHONY: default deps base build stop shell run
export SERVICE_NAME := watchkeeper
BUILD_ENV ?= dev
HISTORY_FILE := ~/.bash_history.$(SERVICE_NAME)
# Required for the `deps` task
SHELL := $(shell which bash)
DOCKER := $(shell command -v docker)
COMPOSE := $(shell command -v docker-compose)
COMPOSE_ENV := $(COMPOSE) -f build/$(BUILD_ENV)/docker-compose.yml
COMPOSE_CMD := $(COMPOSE_ENV) run --rm $(SERVICE_NAME)
export GID := $(shell id -g)
export UID := $(shell id -u)
deps:
ifndef DOCKER
@echo "Docker is not available. Please install docker"
@exit 1
endif
ifndef COMPOSE
@echo "docker-compose is not available. Please install docker-compose"
@exit 1
endif
@touch $(HISTORY_FILE)
base: deps
$(COMPOSE) -f build/base/docker-compose.yml build
build: base
$(COMPOSE_ENV) build
stop:
$(COMPOSE_ENV) stop
$(COMPOSE_ENV) rm -f -v
shell: build
$(COMPOSE_CMD) /bin/bash
run: build
$(COMPOSE_ENV) run --rm $(SERVICE_NAME);$(COMPOSE_ENV) stop