docker-mysql-cron-backup/docker-compose.yaml

42 lines
979 B
YAML
Raw Normal View History

services:
mariadb:
2024-12-08 12:52:35 +01:00
image: mariadb:10.11
2024-09-10 19:47:30 +02:00
container_name: my_mariadb
2024-12-08 12:52:35 +01:00
security_opt:
- seccomp:unconfined
expose:
- 3306
volumes:
- data:/var/lib/mysql
- ${VOLUME_PATH}/backup:/backup
environment:
- MYSQL_DATABASE=${DATABASE_NAME}
- MYSQL_ROOT_PASSWORD=${MARIADB_ROOT_PASSWORD}
2024-09-10 19:47:30 +02:00
- MYSQL_ALLOW_EMPTY_ROOT_PASSWORD=yes
restart: unless-stopped
2024-09-10 19:47:30 +02:00
healthcheck:
2024-12-08 12:52:35 +01:00
test: [ "CMD", "healthcheck.sh", "--su-mysql", "--connect" ]
2024-09-10 19:47:30 +02:00
timeout: 5s
retries: 10
backup:
build: .
image: fradelg/mysql-cron-backup
depends_on:
2024-09-10 19:47:30 +02:00
mariadb:
condition: service_healthy
volumes:
- ${VOLUME_PATH}/backup:/backup
environment:
2024-09-10 19:47:30 +02:00
- MYSQL_HOST=my_mariadb
- MYSQL_USER=root
2024-12-08 13:56:43 +01:00
- MYSQL_DATABASE=${DATABASE_NAME}
- MYSQL_PASS=${MARIADB_ROOT_PASSWORD}
- MAX_BACKUPS=1
- INIT_BACKUP=1
- CRON_TIME=0 0 * * *
restart: unless-stopped
2024-12-08 12:52:35 +01:00
volumes:
2024-09-10 19:37:59 +02:00
data: