
- Nâng cấp MySQL image lên phiên bản 8.0 - Thêm các tùy chọn cấu hình chi tiết cho hiệu suất và bảo mật - Cập nhật healthcheck và các tham số kết nối - Thêm volume khởi tạo và cấu hình character set - Điều chỉnh các tham số hiệu suất MySQL
93 lines
2.8 KiB
YAML
93 lines
2.8 KiB
YAML
services:
|
|
app:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile.dev
|
|
restart: unless-stopped
|
|
ports:
|
|
- ${PORT}:${PORT}
|
|
environment:
|
|
APP_ENV: ${APP_ENV}
|
|
PORT: ${PORT}
|
|
BLUEPRINT_DB_HOST: mysql_bp
|
|
BLUEPRINT_DB_PORT: ${BLUEPRINT_DB_PORT}
|
|
BLUEPRINT_DB_DATABASE: ${BLUEPRINT_DB_DATABASE}
|
|
BLUEPRINT_DB_USERNAME: ${BLUEPRINT_DB_USERNAME}
|
|
BLUEPRINT_DB_PASSWORD: ${BLUEPRINT_DB_PASSWORD}
|
|
BLUEPRINT_DB_MAX_IDLE_CONNS: ${BLUEPRINT_DB_MAX_IDLE_CONNS}
|
|
BLUEPRINT_DB_MAX_OPEN_CONNS: ${BLUEPRINT_DB_MAX_OPEN_CONNS}
|
|
BLUEPRINT_DB_CONN_MAX_LIFETIME: ${BLUEPRINT_DB_CONN_MAX_LIFETIME}
|
|
LOGGER_LOG_LEVEL: ${LOGGER_LOG_LEVEL}
|
|
LOGGER_FILE_LOG_NAME: ${LOGGER_FILE_LOG_NAME}
|
|
LOGGER_MAX_SIZE: ${LOGGER_MAX_SIZE}
|
|
LOGGER_MAX_BACKUPS: ${LOGGER_MAX_BACKUPS}
|
|
LOGGER_MAX_AGE: ${LOGGER_MAX_AGE}
|
|
LOGGER_COMPRESS: ${LOGGER_COMPRESS}
|
|
volumes:
|
|
- .:/app # Mount current directory to /app in container
|
|
command: air # Use air for hot-reload
|
|
depends_on:
|
|
mysql_bp:
|
|
condition: service_healthy
|
|
networks:
|
|
- blueprint
|
|
mysql_bp:
|
|
image: mysql:8.0
|
|
platform: linux/arm64
|
|
restart: unless-stopped
|
|
environment:
|
|
MYSQL_DATABASE: ${BLUEPRINT_DB_DATABASE}
|
|
MYSQL_USER: ${BLUEPRINT_DB_USERNAME}
|
|
MYSQL_PASSWORD: ${BLUEPRINT_DB_PASSWORD}
|
|
MYSQL_ROOT_PASSWORD: ${BLUEPRINT_DB_ROOT_PASSWORD}
|
|
MYSQL_ALLOW_EMPTY_PASSWORD: "no"
|
|
ports:
|
|
- "3306:3306"
|
|
volumes:
|
|
- mysql_volume_bp:/var/lib/mysql
|
|
- ./mysql/init:/docker-entrypoint-initdb.d
|
|
command: >
|
|
--default-authentication-plugin=mysql_native_password
|
|
--character-set-server=utf8mb4
|
|
--collation-server=utf8mb4_unicode_ci
|
|
--skip-name-resolve
|
|
--explicit_defaults_for_timestamp=1
|
|
--max_connections=1000
|
|
--innodb_buffer_pool_size=256M
|
|
--innodb_log_buffer_size=16M
|
|
--innodb_log_file_size=256M
|
|
--innodb_write_io_threads=8
|
|
--innodb_read_io_threads=8
|
|
--innodb_thread_concurrency=0
|
|
--innodb_flush_log_at_trx_commit=2
|
|
--innodb_flush_method=O_DIRECT
|
|
--innodb_file_per_table=1
|
|
--bind-address=0.0.0.0
|
|
healthcheck:
|
|
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-p${BLUEPRINT_DB_ROOT_PASSWORD}", "--connect-timeout=5"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
start_period: 180s
|
|
networks:
|
|
- blueprint
|
|
|
|
phpmyadmin:
|
|
image: arm64v8/phpmyadmin:latest
|
|
restart: unless-stopped
|
|
ports:
|
|
- "8081:80"
|
|
environment:
|
|
PMA_HOST: mysql_bp
|
|
PMA_PORT: 3306
|
|
MYSQL_ROOT_PASSWORD: ${BLUEPRINT_DB_ROOT_PASSWORD}
|
|
depends_on:
|
|
mysql_bp:
|
|
condition: service_healthy
|
|
networks:
|
|
- blueprint
|
|
|
|
volumes:
|
|
mysql_volume_bp:
|
|
networks:
|
|
blueprint: |