forked from easi6/docker-mongodump
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
61 lines (45 loc) · 1.47 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
FROM alpine:3.9
# Build-time metadata as defined at http://label-schema.org
ARG BUILD_DATE
ARG VCS_REF
ARG VERSION
LABEL org.label-schema.build-date=$BUILD_DATE \
org.label-schema.name="Auto mongo dump" \
org.label-schema.description="Provides machine who never die with cron job to dump db every day" \
org.label-schema.url="https://cashstory.com" \
org.label-schema.vcs-ref=$VCS_REF \
org.label-schema.vcs-url="https://github.com/BobCashStory/docker-mongo-dump" \
org.label-schema.vendor="Cashstory, Inc." \
org.label-schema.version=$VERSION \
org.label-schema.schema-version="1.0"
ENV NPM_CONFIG_LOGLEVEL warn
ENV TZ Europe/Paris
# Install bash
RUN apk add --no-cache bash jq
# Install mongodb-tools
RUN apk add --no-cache mongodb mongodb-tools
# Install Python
RUN apk add --no-cache python3
# Install tzdata for cron job
RUN apk add --no-cache tzdata
# Install chaperone
RUN pip3 install chaperone
# Install curl for slack notif
RUN apk add --no-cache curl
# Create folder where we dump
RUN mkdir -p /dump
# Create folder for chaperone
RUN mkdir -p /etc/chaperone.d
# Copy chaperone config
COPY confs/chaperone.conf /etc/chaperone.d/chaperone.conf
# Copy scripts
COPY scripts/dump.sh /usr/local/bin/
COPY scripts/slack.sh /usr/local/bin/
# Make scripts runable
RUN chmod +x /usr/local/bin/dump.sh
RUN chmod +x /usr/local/bin/slack.sh
VOLUME /dump
WORKDIR /dump
# Clean up APT when done.
RUN rm -rf /tmp/* /var/tmp/* /var/cache/apk/*
ENTRYPOINT ["/usr/bin/chaperone"]