add Dockerfile to dump the db

This commit is contained in:
Davide Alberani 2017-11-26 22:06:59 +01:00
parent 2740ccc280
commit c9f608be59
4 changed files with 23 additions and 7 deletions

View file

@ -1,7 +0,0 @@
version: '3'
services:
mongo-dump:
image: "mongo:latest"
command: ["mongodump", "--host", "eventman-mongo", "--out", "/tmp/", "--db", "eventman"]
external_links:
- eventman_eventman-mongo_1:eventman-mongo

View file

@ -0,0 +1,8 @@
version: '3'
services:
mongo-dump:
build: ./docker-tools/mongodump/
volumes:
- .:/data
external_links:
- eventman_eventman-mongo_1:eventman-mongo

View file

@ -0,0 +1,9 @@
FROM mongo:latest
LABEL \
maintainer="Davide Alberani <da@erlug.linux.it>" \
vendor="RaspiBO"
VOLUME ["/data"]
COPY run.sh /
CMD ["/run.sh"]

6
docker-tools/mongodump/run.sh Executable file
View file

@ -0,0 +1,6 @@
#!/bin/sh
mongodump --host eventman-mongo --out /tmp/ --db eventman
cd /tmp
tar cfz /data/eventman-dump-`date +'%Y-%m-%dT%H.%M.%S'`.tgz eventman