2021-03-07 12:57:19 +01:00
|
|
|
FROM golang:1.15.8-alpine3.12 AS binary
|
|
|
|
RUN apk -U add openssl git
|
|
|
|
|
|
|
|
ARG DOCKERIZE_VERSION=v0.6.1
|
|
|
|
WORKDIR /go/src/github.com/jwilder
|
2021-05-09 11:28:53 +02:00
|
|
|
RUN git clone https://github.com/jwilder/dockerize.git && \
|
|
|
|
cd dockerize && \
|
|
|
|
git checkout ${DOCKERIZE_VERSION}
|
2021-03-07 12:57:19 +01:00
|
|
|
|
|
|
|
WORKDIR /go/src/github.com/jwilder/dockerize
|
|
|
|
RUN go get github.com/robfig/glock
|
|
|
|
RUN glock sync -n < GLOCKFILE
|
|
|
|
RUN go install
|
|
|
|
|
2023-01-10 05:06:46 +01:00
|
|
|
FROM alpine:3.17.1
|
2017-09-11 09:36:38 +02:00
|
|
|
LABEL maintainer "Fco. Javier Delgado del Hoyo <frandelhoyo@gmail.com>"
|
2017-03-27 21:16:15 +02:00
|
|
|
|
2021-05-08 21:58:48 +02:00
|
|
|
RUN apk add --update \
|
|
|
|
tzdata \
|
|
|
|
bash \
|
|
|
|
mysql-client \
|
|
|
|
gzip \
|
|
|
|
openssl \
|
2021-05-13 20:30:26 +02:00
|
|
|
mariadb-connector-c && \
|
2021-05-08 21:58:48 +02:00
|
|
|
rm -rf /var/cache/apk/*
|
2017-03-27 21:16:15 +02:00
|
|
|
|
2021-03-07 12:57:19 +01:00
|
|
|
COPY --from=binary /go/bin/dockerize /usr/local/bin
|
2018-11-08 14:46:39 +01:00
|
|
|
|
2017-03-27 21:16:15 +02:00
|
|
|
ENV CRON_TIME="0 3 * * sun" \
|
|
|
|
MYSQL_HOST="mysql" \
|
2018-11-09 15:55:53 +01:00
|
|
|
MYSQL_PORT="3306" \
|
2022-02-05 13:01:53 +01:00
|
|
|
TIMEOUT="10s" \
|
|
|
|
MYSQLDUMP_OPTS="--quick"
|
2017-03-27 21:16:15 +02:00
|
|
|
|
2023-01-06 09:29:31 +01:00
|
|
|
COPY ["run.sh", "backup.sh", "restore.sh", "/delete.sh", "/"]
|
2021-05-09 11:28:53 +02:00
|
|
|
RUN mkdir /backup && \
|
|
|
|
chmod 777 /backup && \
|
2023-01-06 09:29:31 +01:00
|
|
|
chmod 755 /run.sh /backup.sh /restore.sh /delete.sh && \
|
2021-05-08 21:58:48 +02:00
|
|
|
touch /mysql_backup.log && \
|
2021-05-09 11:28:53 +02:00
|
|
|
chmod 666 /mysql_backup.log
|
2021-05-08 21:58:48 +02:00
|
|
|
|
2017-03-27 21:16:15 +02:00
|
|
|
VOLUME ["/backup"]
|
|
|
|
|
2018-11-09 15:55:53 +01:00
|
|
|
CMD dockerize -wait tcp://${MYSQL_HOST}:${MYSQL_PORT} -timeout ${TIMEOUT} /run.sh
|