- Multi-stage Dockerfile for minimal image size (~119MB) - Includes PostgreSQL, MySQL, MariaDB client tools - Non-root user (UID 1000) for security - Docker Compose examples for all use cases - Complete Docker documentation (DOCKER.md) - Kubernetes CronJob examples - Support for Docker secrets - Multi-platform build support Docker makes deployment trivial: - No dependency installation needed - Consistent environment - Easy CI/CD integration - Kubernetes-ready
89 lines
1.7 KiB
YAML
89 lines
1.7 KiB
YAML
version: '3.8'
|
|
|
|
services:
|
|
# PostgreSQL backup example
|
|
postgres-backup:
|
|
build: .
|
|
image: dbbackup:latest
|
|
container_name: dbbackup-postgres
|
|
volumes:
|
|
- ./backups:/backups
|
|
- ./config/.dbbackup.conf:/home/dbbackup/.dbbackup.conf:ro
|
|
environment:
|
|
- PGHOST=postgres
|
|
- PGPORT=5432
|
|
- PGUSER=postgres
|
|
- PGPASSWORD=secret
|
|
command: backup single mydb
|
|
depends_on:
|
|
- postgres
|
|
networks:
|
|
- dbnet
|
|
|
|
# MySQL backup example
|
|
mysql-backup:
|
|
build: .
|
|
image: dbbackup:latest
|
|
container_name: dbbackup-mysql
|
|
volumes:
|
|
- ./backups:/backups
|
|
environment:
|
|
- MYSQL_HOST=mysql
|
|
- MYSQL_PORT=3306
|
|
- MYSQL_USER=root
|
|
- MYSQL_PWD=secret
|
|
command: backup single mydb --db-type mysql
|
|
depends_on:
|
|
- mysql
|
|
networks:
|
|
- dbnet
|
|
|
|
# Interactive mode example
|
|
dbbackup-interactive:
|
|
build: .
|
|
image: dbbackup:latest
|
|
container_name: dbbackup-tui
|
|
volumes:
|
|
- ./backups:/backups
|
|
environment:
|
|
- PGHOST=postgres
|
|
- PGUSER=postgres
|
|
- PGPASSWORD=secret
|
|
command: interactive
|
|
stdin_open: true
|
|
tty: true
|
|
networks:
|
|
- dbnet
|
|
|
|
# Test PostgreSQL database
|
|
postgres:
|
|
image: postgres:15-alpine
|
|
container_name: test-postgres
|
|
environment:
|
|
- POSTGRES_PASSWORD=secret
|
|
- POSTGRES_DB=mydb
|
|
volumes:
|
|
- postgres-data:/var/lib/postgresql/data
|
|
networks:
|
|
- dbnet
|
|
|
|
# Test MySQL database
|
|
mysql:
|
|
image: mysql:8.0
|
|
container_name: test-mysql
|
|
environment:
|
|
- MYSQL_ROOT_PASSWORD=secret
|
|
- MYSQL_DATABASE=mydb
|
|
volumes:
|
|
- mysql-data:/var/lib/mysql
|
|
networks:
|
|
- dbnet
|
|
|
|
volumes:
|
|
postgres-data:
|
|
mysql-data:
|
|
|
|
networks:
|
|
dbnet:
|
|
driver: bridge
|