CaiWuXiTong/docker-compose.local.yml

78 lines
2.3 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 本地开发/部署用 Compose 文件
# - 基于 compose.jiangling.yml 改造
# - 新增 mysql 服务(原文件依赖宿主机 MySQL)
# - 改用 bridge 网络替代 host 模式,便于本机访问
#
# 启动: docker compose -f docker-compose.local.yml up -d --build
# 停止: docker compose -f docker-compose.local.yml down
# 日志: docker compose -f docker-compose.local.yml logs -f app
# 初始化:docker compose -f docker-compose.local.yml exec app php artisan install --db-host=mysql --db-name=akaunting --db-username=akaunting --db-password=akaunting123 --admin-email=admin@company.com --admin-password=admin123 --locale=zh-CN
services:
app:
build:
context: .
dockerfile: deploy/Dockerfile.local
image: jiangling_akaunting:local
container_name: jiangling_app
restart: unless-stopped
depends_on:
mysql:
condition: service_healthy
ports:
- "18088:18088"
volumes:
- ./runtime/.env:/var/www/html/.env
- jiangling_storage:/var/www/html/storage
- ./app:/var/www/html/app
- ./config:/var/www/html/config
- ./database:/var/www/html/database
- ./modules:/var/www/html/modules
- ./resources:/var/www/html/resources
- ./routes:/var/www/html/routes
networks:
- jiangling_net
healthcheck:
test: ["CMD", "curl", "-fsS", "-o", "/dev/null", "http://127.0.0.1:18088/auth/login"]
interval: 15s
timeout: 5s
retries: 10
start_period: 60s
mysql:
image: mysql:8.0
container_name: jiangling_mysql
restart: unless-stopped
environment:
MYSQL_ROOT_PASSWORD: rootpass
MYSQL_DATABASE: akaunting
MYSQL_USER: akaunting
MYSQL_PASSWORD: akaunting123
command:
- --character-set-server=utf8mb4
- --collation-server=utf8mb4_unicode_ci
- --default-authentication-plugin=mysql_native_password
volumes:
- jiangling_mysql:/var/lib/mysql
ports:
- "13306:3306"
networks:
- jiangling_net
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "127.0.0.1", "-u", "root", "-p$$MYSQL_ROOT_PASSWORD"]
interval: 5s
timeout: 5s
retries: 20
start_period: 30s
volumes:
jiangling_storage:
name: jiangling_storage
jiangling_mysql:
name: jiangling_mysql
networks:
jiangling_net:
name: jiangling_net
driver: bridge