blob: 38f159c21ac7fffaf98175b61abd467dca98ae72 [file] [log] [blame]
David K. Bainbridge9c24cbf2015-12-03 11:49:01 -08001IMAGE_NAME:=xosproject/xos-postgress
2CONTAINER_NAME:=xos-db-postgress
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
17.PHONE: 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