AML/docs/AML_Backend/docker-compose本地开发/docker-compose.local.yml

87 lines
3.0 KiB
YAML

# Local development stack for iCON.Abp.FX.HttpApi.Host
#
# docker compose -f docker-compose.local.yml up -d --build
#
# Services:
# mssql - SQL Server 2022 (amd64 under Rosetta on Apple Silicon)
# db-migrator - runs once: applies EF migrations + seeds data, then exits
# httpapi-host - the API; waits for a successful migration before starting
#
# After it is up:
# Swagger : http://localhost:44331/swagger
# DB : localhost,11433 (sa / Aml@Local2026)
# Admin : admin / 1q2w3E*
name: aml-local
services:
mssql:
image: mcr.microsoft.com/mssql/server:2022-latest
platform: linux/amd64 # Apple Silicon: requires Rosetta emulation in Docker Desktop
container_name: aml-mssql
environment:
ACCEPT_EULA: "Y"
MSSQL_SA_PASSWORD: "Aml@Local2026"
MSSQL_PID: "Developer"
ports:
- "11433:1433"
volumes:
- mssql-data:/var/opt/mssql
healthcheck:
test: ["CMD-SHELL", "/opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P \"$$MSSQL_SA_PASSWORD\" -C -Q \"SELECT 1\" -b"]
interval: 10s
timeout: 5s
retries: 30
start_period: 60s
db-migrator:
build:
context: .
dockerfile: Dockerfile.local
target: migrator
image: aml-dbmigrator:local
container_name: aml-dbmigrator
depends_on:
mssql:
condition: service_healthy
environment:
DOTNET_ENVIRONMENT: "Development"
ConnectionStrings__Default: "Server=mssql,1433;Database=AbpAML;User Id=sa;Password=Aml@Local2026;TrustServerCertificate=True;Encrypt=False;"
restart: "no"
httpapi-host:
build:
context: .
dockerfile: Dockerfile.local
target: host
image: aml-httpapi-host:local
container_name: aml-httpapi-host
depends_on:
mssql:
condition: service_healthy
db-migrator:
condition: service_completed_successfully
ports:
- "44331:44331"
volumes:
# ABP commercial license token (from `abp login`). The runtime license
# check reads /root/.abp/cli/access-token.bin; without it the host aborts
# (ABP-LIC-0008). Generate once with: abp login <user> -o <org> -p <pwd>
- "${HOME}/.abp/cli:/root/.abp/cli:ro"
environment:
ASPNETCORE_ENVIRONMENT: "Development"
ASPNETCORE_URLS: "http://+:44331"
ConnectionStrings__Default: "Server=mssql,1433;Database=AbpAML;User Id=sa;Password=Aml@Local2026;TrustServerCertificate=True;Encrypt=False;"
# IdentityServer issuer / self URL must match the URL used by the browser.
App__SelfUrl: "http://localhost:44331"
AuthServer__Authority: "http://localhost:44331"
AuthServer__RequireHttpsMetadata: "false"
# Silence integrations that point at unreachable infra in local dev.
AppConfig__RabbitMQConfig__EnableConsumer: "false"
AppConfig__RabbitMQConfig__HostName: "127.0.0.1"
AppConfig__JobConfig__SanctionJob__Enabled: "false"
AppConfig__JobConfig__EngineListSyncJob__Enabled: "false"
restart: unless-stopped
volumes:
mssql-data: