From c9f608be59101f65c93d977679d5f616d2936525 Mon Sep 17 00:00:00 2001 From: Davide Alberani Date: Sun, 26 Nov 2017 22:06:59 +0100 Subject: [PATCH] add Dockerfile to dump the db --- docker-compose-mongo-cmd.yml | 7 ------- docker-compose-mongodump.yml | 8 ++++++++ docker-tools/mongodump/Dockerfile | 9 +++++++++ docker-tools/mongodump/run.sh | 6 ++++++ 4 files changed, 23 insertions(+), 7 deletions(-) delete mode 100644 docker-compose-mongo-cmd.yml create mode 100644 docker-compose-mongodump.yml create mode 100644 docker-tools/mongodump/Dockerfile create mode 100755 docker-tools/mongodump/run.sh diff --git a/docker-compose-mongo-cmd.yml b/docker-compose-mongo-cmd.yml deleted file mode 100644 index 8c51342..0000000 --- a/docker-compose-mongo-cmd.yml +++ /dev/null @@ -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 diff --git a/docker-compose-mongodump.yml b/docker-compose-mongodump.yml new file mode 100644 index 0000000..85cd51a --- /dev/null +++ b/docker-compose-mongodump.yml @@ -0,0 +1,8 @@ +version: '3' +services: + mongo-dump: + build: ./docker-tools/mongodump/ + volumes: + - .:/data + external_links: + - eventman_eventman-mongo_1:eventman-mongo diff --git a/docker-tools/mongodump/Dockerfile b/docker-tools/mongodump/Dockerfile new file mode 100644 index 0000000..4a582c0 --- /dev/null +++ b/docker-tools/mongodump/Dockerfile @@ -0,0 +1,9 @@ +FROM mongo:latest +LABEL \ + maintainer="Davide Alberani " \ + vendor="RaspiBO" + +VOLUME ["/data"] + +COPY run.sh / +CMD ["/run.sh"] diff --git a/docker-tools/mongodump/run.sh b/docker-tools/mongodump/run.sh new file mode 100755 index 0000000..cd2ceb6 --- /dev/null +++ b/docker-tools/mongodump/run.sh @@ -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 +