blob: 8f483f8491a893e5eede973a32eb2b5b703c188c [file] [log] [blame]
David K. Bainbridgea0241eb2015-12-09 09:54:40 -08001IMAGE_NAME:=xosproject/xos-postgres
2CONTAINER_NAME:=xos-db-postgres
David K. Bainbridgeb7a3ee12015-12-03 20:24:30 -08003NO_DOCKER_CACHE?=false
David K. Bainbridge9c24cbf2015-12-03 11:49:01 -08004
Tony Mack8a261c62015-10-29 21:14:41 +00005.PHONY: build
David K. Bainbridgeb7a3ee12015-12-03 20:24:30 -08006build: ; docker build --no-cache=${NO_DOCKER_CACHE} --rm -t ${IMAGE_NAME} .
Tony Mack8a261c62015-10-29 21:14:41 +00007
8.PHONY: run
David K. Bainbridge9c24cbf2015-12-03 11:49:01 -08009run: ; docker run -d -p 5432:5432 --name ${CONTAINER_NAME} ${IMAGE_NAME}
Tony Mack8a261c62015-10-29 21:14:41 +000010
11.PHONY: stop
David K. Bainbridge9c24cbf2015-12-03 11:49:01 -080012stop: ; docker stop ${CONTAINER_NAME}
Tony Mack8a261c62015-10-29 21:14:41 +000013
14.PHONY: rm
David K. Bainbridge9c24cbf2015-12-03 11:49:01 -080015rm: ; docker rm ${CONTAINER_NAME}
Tony Mack8a261c62015-10-29 21:14:41 +000016
Zack Williams743de622016-04-05 12:03:43 -070017.PHONY: rmi
David K. Bainbridge9c24cbf2015-12-03 11:49:01 -080018rmi: ; docker rmi ${IMAGE_NAME}
Tony Mack8a261c62015-10-29 21:14:41 +000019
20.PHONY: backup
David K. Bainbridge9c24cbf2015-12-03 11:49:01 -080021backupvol: ; docker run --volumes-from ${CONTAINER_NAME} -v /backup:/backup postgres tar cvf /backup/backup-postgres.tar /var/lib/postgresql
Tony Mack8a261c62015-10-29 21:14:41 +000022
23.PHONY: restore
David K. Bainbridge9c24cbf2015-12-03 11:49:01 -080024restorevol: ; docker run --volumes-from ${CONTAINER_NAME} -v /backup:/backup postgres cd /var/lib/postgresql && tar xvf /backup/backup-postgres.tar
Tony Mack8a261c62015-10-29 21:14:41 +000025