blob: c50923ed26a276584c8cff45d0cd47cca2405169 [file] [log] [blame]
Pingping Linb7a7d2b2016-08-19 18:11:36 +00001IMAGE_NAME:=xosproject/xos-postgres
2CONTAINER_NAME:=xos-db-postgres
3NO_DOCKER_CACHE?=false
4
5.PHONY: build
6build: ; docker build --no-cache=${NO_DOCKER_CACHE} --rm -t ${IMAGE_NAME} .
7
8.PHONY: run
9run: ; docker run -d -p 5432:5432 --name ${CONTAINER_NAME} ${IMAGE_NAME}
10
11.PHONY: stop
12stop: ; docker stop ${CONTAINER_NAME}
13
14.PHONY: rm
15rm: ; docker rm ${CONTAINER_NAME}
16
17.PHONE: rmi
18rmi: ; docker rmi ${IMAGE_NAME}
19
20.PHONY: backup
21backupvol: ; docker run --volumes-from ${CONTAINER_NAME} -v /backup:/backup postgres tar cvf /backup/backup-postgres.tar /var/lib/postgresql
22
23.PHONY: restore
24restorevol: ; docker run --volumes-from ${CONTAINER_NAME} -v /backup:/backup postgres cd /var/lib/postgresql && tar xvf /backup/backup-postgres.tar
25