mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-02-16 02:39:03 +00:00
Add database seeding to dev env
This commit is contained in:
94
docker-compose.test.yaml
Normal file
94
docker-compose.test.yaml
Normal file
@@ -0,0 +1,94 @@
|
||||
services:
|
||||
sqlserver:
|
||||
image: mcr.microsoft.com/mssql/server:2022-latest
|
||||
platform: linux/amd64
|
||||
container_name: test-env-sqlserver
|
||||
environment:
|
||||
ACCEPT_EULA: "Y"
|
||||
SA_PASSWORD: "${SA_PASSWORD}"
|
||||
MSSQL_PID: "Express"
|
||||
DOTNET_RUNNING_IN_CONTAINER: "true"
|
||||
volumes:
|
||||
- sqlserverdata-test:/var/opt/mssql
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "/opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P '${SA_PASSWORD}' -C -Q 'SELECT 1' || exit 1"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 12
|
||||
start_period: 30s
|
||||
networks:
|
||||
- testnet
|
||||
|
||||
database.migrations:
|
||||
image: database.migrations
|
||||
container_name: test-env-database-migrations
|
||||
depends_on:
|
||||
sqlserver:
|
||||
condition: service_healthy
|
||||
build:
|
||||
context: ./src/Core/Database
|
||||
dockerfile: Database.Migrations/Dockerfile
|
||||
args:
|
||||
BUILD_CONFIGURATION: Release
|
||||
APP_UID: 1000
|
||||
environment:
|
||||
DOTNET_RUNNING_IN_CONTAINER: "true"
|
||||
DB_CONNECTION_STRING: "${TEST_DB_CONNECTION_STRING}"
|
||||
MASTER_DB_CONNECTION_STRING: "${TEST_MASTER_DB_CONNECTION_STRING}"
|
||||
CLEAR_DATABASE: "true"
|
||||
restart: "no"
|
||||
networks:
|
||||
- testnet
|
||||
|
||||
database.seed:
|
||||
image: database.seed
|
||||
container_name: test-env-database-seed
|
||||
depends_on:
|
||||
database.migrations:
|
||||
condition: service_completed_successfully
|
||||
build:
|
||||
context: ./src/Core
|
||||
dockerfile: Database/Database.Seed/Dockerfile
|
||||
args:
|
||||
BUILD_CONFIGURATION: Release
|
||||
APP_UID: 1000
|
||||
environment:
|
||||
DOTNET_RUNNING_IN_CONTAINER: "true"
|
||||
DB_CONNECTION_STRING: "${TEST_DB_CONNECTION_STRING}"
|
||||
restart: "no"
|
||||
networks:
|
||||
- testnet
|
||||
|
||||
api.specs:
|
||||
image: api.specs
|
||||
container_name: test-env-api-specs
|
||||
depends_on:
|
||||
sqlserver:
|
||||
condition: service_healthy
|
||||
database.migrations:
|
||||
condition: service_completed_successfully
|
||||
database.seed:
|
||||
condition: service_completed_successfully
|
||||
build:
|
||||
context: ./src/Core
|
||||
dockerfile: API/API.Specs/Dockerfile
|
||||
args:
|
||||
BUILD_CONFIGURATION: Release
|
||||
environment:
|
||||
ASPNETCORE_ENVIRONMENT: "Test"
|
||||
DOTNET_RUNNING_IN_CONTAINER: "true"
|
||||
API_BASE_URL: "http://api.core:8080"
|
||||
DB_CONNECTION_STRING: "${TEST_DB_CONNECTION_STRING}"
|
||||
volumes:
|
||||
- ./test-results:/app/test-results
|
||||
restart: "no"
|
||||
networks:
|
||||
- testnet
|
||||
|
||||
volumes:
|
||||
sqlserverdata-test:
|
||||
driver: local
|
||||
|
||||
networks:
|
||||
testnet:
|
||||
driver: bridge
|
||||
Reference in New Issue
Block a user