-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompose.old.yaml
More file actions
121 lines (113 loc) · 3.45 KB
/
Copy pathcompose.old.yaml
File metadata and controls
121 lines (113 loc) · 3.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# docker compose --profile dev up -d
# docker compose --profile prod up -d
name: mini-server
networks:
backend:
volumes:
db-data:
nuget-cache:
services:
db:
image: mcr.microsoft.com/mssql/server:2022-latest
profiles: ["dev", "prod"]
environment:
ACCEPT_EULA: "Y"
MSSQL_PID: Developer
MSSQL_SA_PASSWORD: ${MSSQL_SA_PASSWORD}
volumes:
- db-data:/var/opt/mssql
networks: [backend]
healthcheck:
test:
[
"CMD-SHELL",
"(/opt/mssql-tools18/bin/sqlcmd -C -S localhost -U sa -P ${MSSQL_SA_PASSWORD} -Q \"SELECT 1\" 2>/dev/null) || (/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P ${MSSQL_SA_PASSWORD} -Q \"SELECT 1\") || exit 1"
]
interval: 5s
timeout: 3s
retries: 40
restart: unless-stopped
migrator:
profiles: ["prod"]
build:
context: .
dockerfile: ./Dockerfile
target: publish
working_dir: /app/publish
depends_on:
db:
condition: service_healthy
networks: [backend]
environment:
DB_NAME: ${DB_NAME}
DB_MIGRATOR_USER: ${DB_MIGRATOR_USER}
DB_MIGRATOR_PASSWORD: ${DB_MIGRATOR_PASSWORD}
DB_RUNTIME_USER: ${DB_RUNTIME_USER}
DB_RUNTIME_PASSWORD: ${DB_RUNTIME_PASSWORD}
MSSQL_SA_PASSWORD: ${MSSQL_SA_PASSWORD}
ConnectionStrings__Bootstrap: >-
Server=db;Database=master;User Id=sa;Password=${MSSQL_SA_PASSWORD};
TrustServerCertificate=true;Encrypt=true
ConnectionStrings__Migrations: >-
Server=db;Database=${DB_NAME};User Id=${DB_MIGRATOR_USER};Password=${DB_MIGRATOR_PASSWORD};
TrustServerCertificate=true;Encrypt=true
command: ["dotnet","MiniServer.API.dll","--bootstrap-users","--run-migrations-and-exit"]
restart: "no"
api:
profiles: ["prod"]
build:
context: .
dockerfile: ./Dockerfile
target: final
environment:
ASPNETCORE_ENVIRONMENT: Production
ASPNETCORE_URLS: ${ASPNETCORE_URLS}
DOTNET_NOLOGO: 1
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_EnableDiagnostics: 0
DOTNET_USE_POLLING_FILE_WATCHER: 0
ConnectionStrings__Default: >-
Server=db;Database=${DB_NAME};User Id=${DB_RUNTIME_USER};Password=${DB_RUNTIME_PASSWORD};
TrustServerCertificate=true;Encrypt=true
depends_on:
db:
condition: service_healthy
migrator:
condition: service_completed_successfully
ports:
- "8080:8080"
restart: unless-stopped
networks: [backend]
api-dev:
profiles: ["dev"]
build:
context: .
dockerfile: ./Dockerfile
target: dev
working_dir: /src
volumes:
- ./:/src
- nuget-cache:/root/.nuget/packages
- /src/MiniServer.API/bin
- /src/MiniServer.API/obj
environment:
PATH: $PATH:/root/.dotnet/tools
ASPNETCORE_ENVIRONMENT: Development
ASPNETCORE_URLS: ${ASPNETCORE_URLS}
DOTNET_NOLOGO: 1
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_EnableDiagnostics: 1
DOTNET_USE_POLLING_FILE_WATCHER: 1
DOTNET_WATCH_RESTART_ON_RUDE_EDIT: 1
NUGET_FALLBACK_PACKAGES:
NUGET_PACKAGES: /root/.nuget/packages
ConnectionStrings__Default: >-
Server=db;Database=${DEV_DB_NAME};User Id=sa;Password=${MSSQL_SA_PASSWORD};
TrustServerCertificate=true;Encrypt=false
depends_on:
db:
condition: service_healthy
ports:
- "8080:8080"
command: ["dotnet","watch","--project","API","run"]
networks: [backend]