-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
42 lines (28 loc) · 823 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
include env_make
VERSION ?= 01
REPO = postgres_db
NAME = postgres9.5
.PHONY: build push shell run start stop rm release
build:
docker build -t $(REPO):$(VERSION) .
push:
docker push $(REPO):$(VERSION)
debug:
docker run --rm --name $(NAME) -i -t $(PORTS) $(VOLUMES) $(REPO):$(VERSION) /bin/bash
run:
docker run --rm --name $(NAME) $(PORTS) $(VOLUMES) $(ENV) $(REPO):$(VERSION)
start:
docker run -d --name $(NAME) $(PORTS) $(VOLUMES) $(ENV) $(REPO):$(VERSION)
stop:
docker stop $(NAME)
rm:
docker rm $(NAME)
release: build
make push -e VERSION=$(VERSION)
default: build
and don’t forget to place an env_make file next to your Makefile that is ignored by the VCS:
PORTS = -p 5432:5432
VOLUMES = -v postgres:/var/lib/postgresql/data
ENV = \
-e POSTGRES_USER='toto' \
-e POSTGRES_PASSWORD='totototo'