forked from prodrigestivill/docker-postgres-backup-local
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile-debian
37 lines (31 loc) · 1.17 KB
/
Dockerfile-debian
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
ARG BASETAG=latest
FROM postgres:$BASETAG
ARG GOCRONVER=v0.0.9
ARG TARGETOS
ARG TARGETARCH
RUN set -x \
&& apt-get update && apt-get install -y --no-install-recommends ca-certificates curl && rm -rf /var/lib/apt/lists/* \
&& curl -L https://github.com/prodrigestivill/go-cron/releases/download/$GOCRONVER/go-cron-$TARGETOS-$TARGETARCH.gz | zcat > /usr/local/bin/go-cron \
&& chmod a+x /usr/local/bin/go-cron \
&& apt-get purge -y --auto-remove ca-certificates && apt-get clean
ENV POSTGRES_DB="**None**" \
POSTGRES_DB_FILE="**None**" \
POSTGRES_HOST="**None**" \
POSTGRES_PORT=5432 \
POSTGRES_USER="**None**" \
POSTGRES_USER_FILE="**None**" \
POSTGRES_PASSWORD="**None**" \
POSTGRES_PASSWORD_FILE="**None**" \
POSTGRES_EXTRA_OPTS="-Z9" \
SCHEDULE="@daily" \
BACKUP_DIR="/backups" \
BACKUP_KEEP_DAYS=7 \
BACKUP_KEEP_WEEKS=4 \
BACKUP_KEEP_MONTHS=6 \
HEALTHCHECK_PORT=8080
COPY backup.sh /backup.sh
VOLUME /backups
ENTRYPOINT ["/bin/sh", "-c"]
CMD ["exec /usr/local/bin/go-cron -s \"$SCHEDULE\" -p \"$HEALTHCHECK_PORT\" -- /backup.sh"]
HEALTHCHECK --interval=5m --timeout=3s \
CMD curl -f "http://localhost:$HEALTHCHECK_PORT/" || exit 1