docker-mysql-cron-backup/Dockerfile

24 lines
835 B
Text
Raw Normal View History

2020-07-06 12:25:54 +02:00
FROM alpine:3.12
2017-09-11 09:36:38 +02:00
LABEL maintainer "Fco. Javier Delgado del Hoyo <frandelhoyo@gmail.com>"
RUN apk add --update tzdata bash mysql-client gzip openssl mariadb-connector-c && rm -rf /var/cache/apk/*
2020-06-08 17:06:39 +02:00
ARG OS=alpine-linux
ARG ARCH=amd64
ARG DOCKERIZE_VERSION=v0.6.1
RUN wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-$OS-$ARCH-$DOCKERIZE_VERSION.tar.gz \
&& tar -C /usr/local/bin -xzvf dockerize-$OS-$ARCH-$DOCKERIZE_VERSION.tar.gz \
&& rm dockerize-$OS-$ARCH-$DOCKERIZE_VERSION.tar.gz
2018-11-08 14:46:39 +01:00
ENV CRON_TIME="0 3 * * sun" \
MYSQL_HOST="mysql" \
2018-11-09 15:55:53 +01:00
MYSQL_PORT="3306" \
TIMEOUT="10s"
2019-07-28 15:58:55 +02:00
COPY ["run.sh", "backup.sh", "restore.sh", "/"]
RUN mkdir /backup && chmod u+x /backup.sh /restore.sh
VOLUME ["/backup"]
2018-11-09 15:55:53 +01:00
CMD dockerize -wait tcp://${MYSQL_HOST}:${MYSQL_PORT} -timeout ${TIMEOUT} /run.sh