-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker.mk
56 lines (48 loc) · 1.17 KB
/
docker.mk
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
# Include this in the Makefile of projects that use docker, but aren't
# publishing a docker base image for other projects to use.
#
# include github.com/xentek/makefiles/docker
#
# PLEASE NOTE: you must set NAME and IMG vars in your project's Makefile
TAG=latest
.PHONY: container boot create destroy tag release
# build container
container:
docker build -t ${IMG} .
# run the Docker container
#
# arguments:
#
# - NAME: name of container. default: mm-go
boot: create
docker start -ai ${NAME}
# create the Docker container
#
# arguments:
#
# - NAME: name of container. default: mm-go
create: destroy container
docker create --env-file ${CURDIR}/.env -it --init --name "${NAME}" ${IMG}
# destroy the Docker container
#
# arguments:
#
# - NAME: name of container. default: mm-subscribers
destroy:
docker stop ${NAME} || (exit 0)
docker rm -v $(shell docker ps -aqf "name=${NAME}") || (exit 0)
# tag container
#
# arguments:
#
# - TAG: tag the container. default: latest
tag: container
docker tag ${IMG} ${IMG}:${TAG}
# release the Docker container
#
# arguments:
#
# - TAG: tag the container. default: latest
release: tag
docker push ${IMG}:${TAG}
# vim: set ft=make