41 lines
951 B
YAML
41 lines
951 B
YAML
x-default: &default
|
|
restart: unless-stopped
|
|
logging:
|
|
driver: json-file
|
|
options:
|
|
max-size: 100m
|
|
max-file: "3"
|
|
|
|
services:
|
|
mysql:
|
|
<<: *default
|
|
image: mysql:${MYSQL_VERSION:-9.4.0}
|
|
ports:
|
|
- "${MYSQL_PORT_OVERRIDE:-3306}:3306"
|
|
volumes:
|
|
- mysql_data:/var/lib/mysql
|
|
|
|
# Initialize database with scripts in ./init.sql
|
|
# - ./init.sql:/docker-entrypoint-initdb.d/init.sql:ro
|
|
environment:
|
|
TZ: ${TZ:-UTC}
|
|
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-password}
|
|
MYSQL_ROOT_HOST: ${MYSQL_ROOT_HOST:-%}
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: '2.0'
|
|
memory: 2G
|
|
reservations:
|
|
cpus: '0.5'
|
|
memory: 512M
|
|
healthcheck:
|
|
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-p$$MYSQL_ROOT_PASSWORD"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 30s
|
|
|
|
volumes:
|
|
mysql_data:
|