-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommon.mk
More file actions
executable file
·56 lines (39 loc) · 1.63 KB
/
Copy pathcommon.mk
File metadata and controls
executable file
·56 lines (39 loc) · 1.63 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
## This is a common makefile for docker management.
## Include in later makefiles, which define the overrides below.
# Variables to override in including makefiles:
CONTAINER:=undef
EXTRARUNOPTIONS:=undef
EXTRARUNARGS:=
# Common configuration options (make sure to use =, not :=, for late binding)
REPO=monroe
DOCKERFILE=$(CONTAINER).docker
CONTAINERTAG=monroe/$(CONTAINER)
# Common targets
all:
@echo "Instructions:"
@echo "1. 'make image' is used to build image $(CONTAINERTAG)"
@echo "2. 'make push' pushes the image to the monroe repository (be sure to 'docker login' first!)"
@echo "3. 'make run-local PASSPHRASE' starts a container from a local build"
@echo "4. 'make run-repo PASSPHRASE' starts a container from the repository"
@echo "5. 'make stop' stops and removes running a container based on image $(CONTAINERTAG)."
stop:
@echo "Stopping possibly previous running container (_undefined_ error is OK)"
docker ps | grep $(CONTAINERTAG) | cut -f 1 -d ' ' | xargs docker rm -f _undefined_ || true
push:
docker push $(REPO)/$(CONTAINERTAG)
image:
docker build -f --rm --no-cache -f $(DOCKERFILE) -t $(CONTAINERTAG):latest .
run-local: stop
@echo "Starting container."
docker run -i -t $(RUNOPTIONS) $(CONTAINERTAG) $(RUNARGS)
run-repo: stop
@echo "Starting container."
docker pull $(REPO)/$(CONTAINERTAG)
docker run -i -t $(RUNOPTIONS) $(REPO)/$(CONTAINERTAG) $(RUNARGS)
run-manual:
@echo docker run -d $(RUNOPTIONS) $(REPO)/$(CONTAINERTAG) $(RUNARGS)
pull-manual:
@echo docker pull $(REPO)/$(CONTAINERTAG)
run-daemon: stop
@echo "Starting daemonized container."
docker run -d $(RUNOPTIONS) $(REPO)/$(CONTAINERTAG) $(RUNARGS)