mirror of
https://github.com/fradelg/docker-mysql-cron-backup.git
synced 2025-01-19 00:32:34 +01:00
Compare commits
No commits in common. "cff595e6340c44ac53132dd4fed93872f85f0ca4" and "d5d98e5a7c677b1f0ebdd8c6464ec2c54c4c24ba" have entirely different histories.
cff595e634
...
d5d98e5a7c
3 changed files with 15 additions and 23 deletions
|
@ -12,15 +12,15 @@ ENV GO111MODULE=on
|
||||||
RUN go mod tidy
|
RUN go mod tidy
|
||||||
RUN CGO_ENABLED=0 GOOS=linux GO111MODULE=on go build -a -o /go/bin/dockerize .
|
RUN CGO_ENABLED=0 GOOS=linux GO111MODULE=on go build -a -o /go/bin/dockerize .
|
||||||
|
|
||||||
FROM alpine:3.20.3
|
FROM alpine:3.21.0
|
||||||
LABEL maintainer "Fco. Javier Delgado del Hoyo <frandelhoyo@gmail.com>"
|
LABEL maintainer "Fco. Javier Delgado del Hoyo <frandelhoyo@gmail.com>"
|
||||||
|
|
||||||
RUN apk add --update \
|
RUN apk add --update \
|
||||||
tzdata \
|
tzdata \
|
||||||
bash \
|
bash \
|
||||||
|
mysql-client \
|
||||||
gzip \
|
gzip \
|
||||||
openssl \
|
openssl \
|
||||||
mysql-client=~10.11 \
|
|
||||||
mariadb-connector-c \
|
mariadb-connector-c \
|
||||||
fdupes && \
|
fdupes && \
|
||||||
rm -rf /var/cache/apk/*
|
rm -rf /var/cache/apk/*
|
||||||
|
|
|
@ -29,13 +29,7 @@ do
|
||||||
echo "==> Dumping database: $db"
|
echo "==> Dumping database: $db"
|
||||||
FILENAME=/backup/$DATE.$db.sql
|
FILENAME=/backup/$DATE.$db.sql
|
||||||
LATEST=/backup/latest.$db.sql
|
LATEST=/backup/latest.$db.sql
|
||||||
BASIC_OPTS="--single-transaction"
|
if mysqldump --single-transaction --skip-comments $MYSQLDUMP_OPTS -h "$MYSQL_HOST" -P "$MYSQL_PORT" -u "$MYSQL_USER" -p"$MYSQL_PASS" $MYSQL_SSL_OPTS "$db" > "$FILENAME"
|
||||||
if [ -n "$REMOVE_DUPLICATES" ]
|
|
||||||
then
|
|
||||||
echo "WARNING: disabling comments in backup to remove deuplicate backups. Automatic database name detection won't work so set MYSQL_DATABASE on restore"
|
|
||||||
BASIC_OPTS="$BASIC_OPTS" --skip-comments
|
|
||||||
fi
|
|
||||||
if mysqldump $BASIC_OPTS $MYSQLDUMP_OPTS -h "$MYSQL_HOST" -P "$MYSQL_PORT" -u "$MYSQL_USER" -p"$MYSQL_PASS" $MYSQL_SSL_OPTS "$db" > "$FILENAME"
|
|
||||||
then
|
then
|
||||||
EXT=
|
EXT=
|
||||||
if [ -z "${USE_PLAIN_SQL}" ]
|
if [ -z "${USE_PLAIN_SQL}" ]
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
|
version: "2"
|
||||||
services:
|
services:
|
||||||
mariadb:
|
mariadb:
|
||||||
image: mariadb:10.11
|
image: mariadb:10
|
||||||
container_name: my_mariadb
|
container_name: my_mariadb
|
||||||
security_opt:
|
|
||||||
- seccomp:unconfined
|
|
||||||
expose:
|
expose:
|
||||||
- 3306
|
- 3306
|
||||||
volumes:
|
volumes:
|
||||||
|
@ -15,7 +14,7 @@ services:
|
||||||
- MYSQL_ALLOW_EMPTY_ROOT_PASSWORD=yes
|
- MYSQL_ALLOW_EMPTY_ROOT_PASSWORD=yes
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: [ "CMD", "healthcheck.sh", "--su-mysql", "--connect" ]
|
test: ["CMD", "healthcheck.sh", "--su-mysql", "--connect"]
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 10
|
retries: 10
|
||||||
|
|
||||||
|
@ -30,7 +29,6 @@ services:
|
||||||
environment:
|
environment:
|
||||||
- MYSQL_HOST=my_mariadb
|
- MYSQL_HOST=my_mariadb
|
||||||
- MYSQL_USER=root
|
- MYSQL_USER=root
|
||||||
- MYSQL_DATABASE=${DATABASE_NAME}
|
|
||||||
- MYSQL_PASS=${MARIADB_ROOT_PASSWORD}
|
- MYSQL_PASS=${MARIADB_ROOT_PASSWORD}
|
||||||
- MAX_BACKUPS=1
|
- MAX_BACKUPS=1
|
||||||
- INIT_BACKUP=1
|
- INIT_BACKUP=1
|
||||||
|
|
Loading…
Reference in a new issue