David K. Bainbridge | ab4a2eb | 2015-12-03 11:49:01 -0800 | [diff] [blame^] | 1 | IMAGE_NAME:=xosproject/xos-postgress |
| 2 | CONTAINER_NAME:=xos-db-postgress |
| 3 | |
Tony Mack | 7ca8c52 | 2015-10-29 21:14:41 +0000 | [diff] [blame] | 4 | .PHONY: build |
David K. Bainbridge | ab4a2eb | 2015-12-03 11:49:01 -0800 | [diff] [blame^] | 5 | build: ; docker build --rm -t ${IMAGE_NAME} . |
Tony Mack | 7ca8c52 | 2015-10-29 21:14:41 +0000 | [diff] [blame] | 6 | |
| 7 | .PHONY: run |
David K. Bainbridge | ab4a2eb | 2015-12-03 11:49:01 -0800 | [diff] [blame^] | 8 | run: ; docker run -d -p 5432:5432 --name ${CONTAINER_NAME} ${IMAGE_NAME} |
Tony Mack | 7ca8c52 | 2015-10-29 21:14:41 +0000 | [diff] [blame] | 9 | |
| 10 | .PHONY: stop |
David K. Bainbridge | ab4a2eb | 2015-12-03 11:49:01 -0800 | [diff] [blame^] | 11 | stop: ; docker stop ${CONTAINER_NAME} |
Tony Mack | 7ca8c52 | 2015-10-29 21:14:41 +0000 | [diff] [blame] | 12 | |
| 13 | .PHONY: rm |
David K. Bainbridge | ab4a2eb | 2015-12-03 11:49:01 -0800 | [diff] [blame^] | 14 | rm: ; docker rm ${CONTAINER_NAME} |
Tony Mack | 7ca8c52 | 2015-10-29 21:14:41 +0000 | [diff] [blame] | 15 | |
| 16 | .PHONE: rmi |
David K. Bainbridge | ab4a2eb | 2015-12-03 11:49:01 -0800 | [diff] [blame^] | 17 | rmi: ; docker rmi ${IMAGE_NAME} |
Tony Mack | 7ca8c52 | 2015-10-29 21:14:41 +0000 | [diff] [blame] | 18 | |
| 19 | .PHONY: backup |
David K. Bainbridge | ab4a2eb | 2015-12-03 11:49:01 -0800 | [diff] [blame^] | 20 | backupvol: ; docker run --volumes-from ${CONTAINER_NAME} -v /backup:/backup postgres tar cvf /backup/backup-postgres.tar /var/lib/postgresql |
Tony Mack | 7ca8c52 | 2015-10-29 21:14:41 +0000 | [diff] [blame] | 21 | |
| 22 | .PHONY: restore |
David K. Bainbridge | ab4a2eb | 2015-12-03 11:49:01 -0800 | [diff] [blame^] | 23 | restorevol: ; docker run --volumes-from ${CONTAINER_NAME} -v /backup:/backup postgres cd /var/lib/postgresql && tar xvf /backup/backup-postgres.tar |
Tony Mack | 7ca8c52 | 2015-10-29 21:14:41 +0000 | [diff] [blame] | 24 | |