-
Notifications
You must be signed in to change notification settings - Fork 153
/
docker-compose.services.debug.yaml
224 lines (219 loc) · 19.7 KB
/
docker-compose.services.debug.yaml
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
# https://www.richard-banks.org/2018/07/debugging-core-in-docker.html
# https://docs.docker.com/compose/reference/#use--f-to-specify-name-and-path-of-one-or-more-compose-files
# https://docs.docker.com/compose/extends/
# Overrid 'docker-compose.yaml' configs here for debug mode
# To build and debug the app on debug machine --> docker-compose -f docker-compose.yaml -f docker-compose.debug.yml build
# To start and debug the app on debug machine --> docker-compose -f docker-compose.yaml -f docker-compose.debug.yaml up -d
version: "3.8"
services:
gateway:
# https://nickjanetakis.com/blog/docker-tip-57-using-build-and-image-in-the-same-docker-compose-service
image: gateway:dev
build:
target: final
context: ../../
dockerfile: src/ApiGateway/dev.Dockerfile
container_name: gateway-debug
# Environment Variables are only passed to processes upon startup, Environment Variables are not reloaded once the process has started so if we need to realod we can use appsetting volume map for waching our setting by app for the volume
# https://www.thorsten-hans.com/hot-reload-net-configuration-in-kubernetes-with-configmaps/
environment:
# https://learn.microsoft.com/en-us/aspnet/core/tutorials/dotnet-watch?view=aspnetcore-7.0#dotnet-watch-configuration
# https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-watch?WT.mc_id=DOP-MVP-5001942#environment-variables
# https://learn.microsoft.com/en-us/aspnet/core/fundamentals/file-providers?view=aspnetcore-3.1#watch-for-changes
# Some file systems, such as Docker containers and network shares, may not reliably send change notifications. Set the DOTNET_USE_POLLING_FILE_WATCHER environment variable to 1 or true to poll the file system for changes every four seconds
# If set to "1" or "true", dotnet watch uses a polling file watcher instead of CoreFx's FileSystemWatcher. Used when watching files on network shares or Docker mounted volumes.
- DOTNET_USE_POLLING_FILE_WATCHER=1
- ConfigurationFolder=${ConfigurationFolder:-config-files/}
- ASPNETCORE_ENVIRONMENT=docker
# https://www.richard-banks.org/2018/07/debugging-core-in-docker.html
# https://oprea.rocks/blog/how-to-properly-override-the-entrypoint-using-docker-run
# https://codewithyury.com/docker-run-vs-cmd-vs-entrypoint/
# https://docs.docker.com/engine/reference/run/#entrypoint-default-command-to-execute-at-runtime
# https://github.com/microsoft/vscode-docker/issues/3831#issuecomment-1433567030
# https://docs.docker.com/compose/compose-file/#entrypoint
##https://stackoverflow.com/questions/38546755/docker-compose-keep-container-running
# for debug mode we change entrypoint with '--entrypoint' in 'docker run' for prevent runing application in this stage inner container because we want to run container app with debugger launcher
entrypoint: /bin/bash
# https://docs.docker.com/engine/reference/run/#foreground
# https://www.baeldung.com/ops/docker-compose-interactive-shell#interactive-shell-in-docker-docker-compose-yml-47a72891aee2
# https://stackoverflow.com/questions/22272401/what-does-it-mean-to-attach-a-tty-std-in-out-to-dockers-or-lxc
tty: true # docker run -t
stdin_open: true # docker run -i
restart: "no"
# https://www.richard-banks.org/2018/07/debugging-core-in-docker.html
# https://copyprogramming.com/howto/docker-compose-says-pwd-variable-not-set-windows
# https://github.com/OmniSharp/omnisharp-vscode/wiki/Attaching-to-remote-processes#installing-vsdbg-on-the-server
# https://docs.docker.com/compose/environment-variables/set-environment-variables/#substitute-from-the-shell
# https://github.com/docker/compose/issues/5089#issuecomment-321822300
# this mappings increase the size of docker image so we use it just in dev, debug mode, in prod its better dockerfile restore just nugets it needs for decresing image size
# here we use full build image for debugging but we change dcoker file `entrypoint` durring `docker run` for for preventing launch app in docker container but with using new entrypoint our stage will run on app working directory and then in our launch.json we launch our app inner container with connecting to `identity-debug` container with `pipeTransport` and `vsdbg` (internaly use dcoker exec and run vsdb on container) and then with using coreclr type and prgram to run, it will run this program with `dotnet run` by coreclr and passed `args`
# https://docs.docker.com/storage/volumes/#use-a-read-only-volume
volumes:
- ~/vsdbg:/vsdbg:ro
- ~/.nuget/packages:/root/.nuget/packages:ro
- ~/.nuget/packages:/home/appuser/.nuget/packages:ro
# https://www.thorsten-hans.com/hot-reload-net-configuration-in-kubernetes-with-configmaps/
# if we need to reload app, we can use volume map for watching our new setting from config-files folder in the the volume or change appsettings.json file in volume map
- src/ApiGateway/FoodDelivery.ApiGateway/${ConfigurationFolder:-config-files/}:/app/config-files/
# https://levelup.gitconnected.com/docker-environment-variables-appsettings-json-net-bdac052bf3db
# https://bartwullems.blogspot.com/2021/03/kubernetesoverride-appsettingsjson-file.html
- ./src/ApiGateway/dev.Dockerfile/FoodDelivery.ApiGateway/appsettings.docker.json:/app/appsettings.docker.json
catalogs:
# https://nickjanetakis.com/blog/docker-tip-57-using-build-and-image-in-the-same-docker-compose-service
image: catalogs:dev
build:
target: final
context: ../../
dockerfile: src/Services/Catalogs/dev.Dockerfile
container_name: catalogs-debug
# Environment Variables are only passed to processes upon startup, Environment Variables are not reloaded once the process has started so if we need to realod we can use appsetting volume map for waching our setting by app for the volume
# https://www.thorsten-hans.com/hot-reload-net-configuration-in-kubernetes-with-configmaps/
environment:
# https://learn.microsoft.com/en-us/aspnet/core/tutorials/dotnet-watch?view=aspnetcore-7.0#dotnet-watch-configuration
# https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-watch?WT.mc_id=DOP-MVP-5001942#environment-variables
# https://learn.microsoft.com/en-us/aspnet/core/fundamentals/file-providers?view=aspnetcore-3.1#watch-for-changes
# Some file systems, such as Docker containers and network shares, may not reliably send change notifications. Set the DOTNET_USE_POLLING_FILE_WATCHER environment variable to 1 or true to poll the file system for changes every four seconds
# If set to "1" or "true", dotnet watch uses a polling file watcher instead of CoreFx's FileSystemWatcher. Used when watching files on network shares or Docker mounted volumes.
- DOTNET_USE_POLLING_FILE_WATCHER=1
- ConfigurationFolder=${ConfigurationFolder:-config-files/}
- ASPNETCORE_ENVIRONMENT=doc
# https://www.richard-banks.org/2018/07/debugging-core-in-docker.html
# https://oprea.rocks/blog/how-to-properly-override-the-entrypoint-using-docker-run
# https://phoenixnap.com/kb/docker-run-override-entrypoint
# https://codewithyury.com/docker-run-vs-cmd-vs-entrypoint/
# https://docs.docker.com/engine/reference/run/#entrypoint-default-command-to-execute-at-runtime
# https://github.com/microsoft/vscode-docker/issues/3831#issuecomment-1433567030
# https://docs.docker.com/compose/compose-file/#entrypoint
##https://stackoverflow.com/questions/38546755/docker-compose-keep-container-running
# for debug mode we change entrypoint with '--entrypoint' in 'docker run' for prevent runing application in this stage inner container because we want to run container app with debugger launcher
entrypoint: /bin/bash
# https://docs.docker.com/engine/reference/run/#foreground
# https://www.baeldung.com/ops/docker-compose-interactive-shell#interactive-shell-in-docker-docker-compose-yml-47a72891aee2
# https://stackoverflow.com/questions/22272401/what-does-it-mean-to-attach-a-tty-std-in-out-to-dockers-or-lxc
tty: true # docker run -t
stdin_open: true # docker run -i
restart: "no"
# https://www.richard-banks.org/2018/07/debugging-core-in-docker.html
# https://copyprogramming.com/howto/docker-compose-says-pwd-variable-not-set-windows
# https://github.com/OmniSharp/omnisharp-vscode/wiki/Attaching-to-remote-processes#installing-vsdbg-on-the-server
# https://docs.docker.com/compose/environment-variables/set-environment-variables/#substitute-from-the-shell
# https://github.com/docker/compose/issues/5089#issuecomment-321822300
# this mappings increase the size of docker image so we use it just in dev, debug mode, in prod its better dockerfile restore just nugets it needs for decresing image size
# here we use full build image for debugging but we change dcoker file `entrypoint` durring `docker run` for for preventing launch app in docker container but with using new entrypoint our stage will run on app working directory and then in our launch.json we launch our app inner container with connecting to `identity-debug` container with `pipeTransport` and `vsdbg` (internaly use dcoker exec and run vsdb on container) and then with using coreclr type and prgram to run, it will run this program with `dotnet run` by coreclr and passed `args`
# https://docs.docker.com/storage/volumes/#use-a-read-only-volume
volumes:
- ~/vsdbg:/vsdbg:ro
- ~/.nuget/packages:/root/.nuget/packages:ro
- ~/.nuget/packages:/home/appuser/.nuget/packages:ro
# https://www.thorsten-hans.com/hot-reload-net-configuration-in-kubernetes-with-configmaps/
# if we need to reload app, we can use volume map for watching our new setting from config-files folder in the the volume or change appsettings.json file in volume map
- src/Services/Catalogs/FoodDelivery.Services.Catalogs.Api/${ConfigurationFolder:-config-files/}:/app/config-files/
# https://levelup.gitconnected.com/docker-environment-variables-appsettings-json-net-bdac052bf3db
# https://bartwullems.blogspot.com/2021/03/kubernetesoverride-appsettingsjson-file.html
- ./src/Services/Catalogs/FoodDelivery.Services.Catalogs.Api/appsettings.docker.json
identity:
# https://nickjanetakis.com/blog/docker-tip-57-using-build-and-image-in-the-same-docker-compose-service
image: identity:dev
build:
target: final
context: ../../
dockerfile: src/Services/Identity/dev.Dockerfile
container_name: identity-debug
# Environment Variables are only passed to processes upon startup, Environment Variables are not reloaded once the process has started so if we need to realod we can use appsetting volume map for waching our setting by app for the volume
# https://www.thorsten-hans.com/hot-reload-net-configuration-in-kubernetes-with-configmaps/
environment:
# https://learn.microsoft.com/en-us/aspnet/core/tutorials/dotnet-watch?view=aspnetcore-7.0#dotnet-watch-configuration
# https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-watch?WT.mc_id=DOP-MVP-5001942#environment-variables
# https://learn.microsoft.com/en-us/aspnet/core/fundamentals/file-providers?view=aspnetcore-3.1#watch-for-changes
# Some file systems, such as Docker containers and network shares, may not reliably send change notifications. Set the DOTNET_USE_POLLING_FILE_WATCHER environment variable to 1 or true to poll the file system for changes every four seconds
# If set to "1" or "true", dotnet watch uses a polling file watcher instead of CoreFx's FileSystemWatcher. Used when watching files on network shares or Docker mounted volumes.
- DOTNET_USE_POLLING_FILE_WATCHER=1
- ConfigurationFolder=${ConfigurationFolder:-config-files/}
- ASPNETCORE_ENVIRONMENT=doc
# https://www.richard-banks.org/2018/07/debugging-core-in-docker.html
# https://oprea.rocks/blog/how-to-properly-override-the-entrypoint-using-docker-run
# https://phoenixnap.com/kb/docker-run-override-entrypoint
# https://codewithyury.com/docker-run-vs-cmd-vs-entrypoint/
# https://docs.docker.com/engine/reference/run/#entrypoint-default-command-to-execute-at-runtime
# https://github.com/microsoft/vscode-docker/issues/3831#issuecomment-1433567030
# https://docs.docker.com/compose/compose-file/#entrypoint
##https://stackoverflow.com/questions/38546755/docker-compose-keep-container-running
# for debug mode we change entrypoint with '--entrypoint' in 'docker run' for prevent runing application in this stage inner container because we want to run container app with debugger launcher
entrypoint: /bin/bash
# https://docs.docker.com/engine/reference/run/#foreground
# https://www.baeldung.com/ops/docker-compose-interactive-shell#interactive-shell-in-docker-docker-compose-yml-47a72891aee2
# https://stackoverflow.com/questions/22272401/what-does-it-mean-to-attach-a-tty-std-in-out-to-dockers-or-lxc
tty: true # docker run -t
stdin_open: true # docker run -i
restart: "no"
# https://www.richard-banks.org/2018/07/debugging-core-in-docker.html
# https://copyprogramming.com/howto/docker-compose-says-pwd-variable-not-set-windows
# https://github.com/OmniSharp/omnisharp-vscode/wiki/Attaching-to-remote-processes#installing-vsdbg-on-the-server
# https://docs.docker.com/compose/environment-variables/set-environment-variables/#substitute-from-the-shell
# https://github.com/docker/compose/issues/5089#issuecomment-321822300
# this mappings increase the size of docker image so we use it just in dev, debug mode, in prod its better dockerfile restore just nugets it needs for decresing image size
# here we use full build image for debugging but we change dcoker file `entrypoint` durring `docker run` for for preventing launch app in docker container but with using new entrypoint our stage will run on app working directory and then in our launch.json we launch our app inner container with connecting to `identity-debug` container with `pipeTransport` and `vsdbg` (internaly use dcoker exec and run vsdb on container) and then with using coreclr type and prgram to run, it will run this program with `dotnet run` by coreclr and passed `args`
# https://docs.docker.com/storage/volumes/#use-a-read-only-volume
volumes:
- ~/vsdbg:/vsdbg:ro
- ~/.nuget/packages:/root/.nuget/packages:ro
- ~/.nuget/packages:/home/appuser/.nuget/packages:ro
# https://www.thorsten-hans.com/hot-reload-net-configuration-in-kubernetes-with-configmaps/
# if we need to reload app, we can use volume map for watching our new setting from config-files folder in the the volume or change appsettings.json file in volume map
- src/Services/Identity/FoodDelivery.Services.Identity.Api/${ConfigurationFolder:-config-files/}:/app/config-files/
# https://levelup.gitconnected.com/docker-environment-variables-appsettings-json-net-bdac052bf3db
# https://bartwullems.blogspot.com/2021/03/kubernetesoverride-appsettingsjson-file.html
- ./src/Services/Identity/FoodDelivery.Services.Identity.Api/appsettings.docker.json
customers:
# https://nickjanetakis.com/blog/docker-tip-57-using-build-and-image-in-the-same-docker-compose-service
image: customers:dev
build:
target: final
context: ../../
dockerfile: src/Services/Customers/dev.Dockerfile
container_name: customers-debug
# Environment Variables are only passed to processes upon startup, Environment Variables are not reloaded once the process has started so if we need to realod we can use appsetting volume map for waching our setting by app for the volume
# https://www.thorsten-hans.com/hot-reload-net-configuration-in-kubernetes-with-configmaps/
environment:
# https://learn.microsoft.com/en-us/aspnet/core/tutorials/dotnet-watch?view=aspnetcore-7.0#dotnet-watch-configuration
# https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-watch?WT.mc_id=DOP-MVP-5001942#environment-variables
# https://learn.microsoft.com/en-us/aspnet/core/fundamentals/file-providers?view=aspnetcore-3.1#watch-for-changes
# Some file systems, such as Docker containers and network shares, may not reliably send change notifications. Set the DOTNET_USE_POLLING_FILE_WATCHER environment variable to 1 or true to poll the file system for changes every four seconds
# If set to "1" or "true", dotnet watch uses a polling file watcher instead of CoreFx's FileSystemWatcher. Used when watching files on network shares or Docker mounted volumes.
- DOTNET_USE_POLLING_FILE_WATCHER=1
- ConfigurationFolder=${ConfigurationFolder:-config-files/}
- ASPNETCORE_ENVIRONMENT=doc
# https://www.richard-banks.org/2018/07/debugging-core-in-docker.html
# https://oprea.rocks/blog/how-to-properly-override-the-entrypoint-using-docker-run
# https://phoenixnap.com/kb/docker-run-override-entrypoint
# https://docs.docker.com/engine/reference/run/#entrypoint-default-command-to-execute-at-runtime
# https://codewithyury.com/docker-run-vs-cmd-vs-entrypoint/
# https://github.com/microsoft/vscode-docker/issues/3831#issuecomment-1433567030
# https://docs.docker.com/compose/compose-file/#entrypointfile/#entrypoint
##https://stackoverflow.com/questions/38546755/docker-compose-keep-container-running
# for debug mode we change entrypoint with '--entrypoint' in 'docker run' for prevent runing application in this stage inner container because we want to run container app with debugger launcher
entrypoint: /bin/bash
tty: true # docker run -t
stdin_open: true # docker run -i
restart: "no"
# https://docs.docker.com/engine/reference/run/#foreground
# https://www.baeldung.com/ops/docker-compose-interactive-shell#interactive-shell-in-docker-docker-compose-yml-47a72891aee2
# https://stackoverflow.com/questions/22272401/what-does-it-mean-to-attach-a-tty-std-in-out-to-dockers-or-lxc
# https://www.richard-banks.org/2018/07/debugging-core-in-docker.html
# https://copyprogramming.com/howto/docker-compose-says-pwd-variable-not-set-windows
# https://github.com/OmniSharp/omnisharp-vscode/wiki/Attaching-to-remote-processes#installing-vsdbg-on-the-server
# https://docs.docker.com/compose/environment-variables/set-environment-variables/#substitute-from-the-shell
# https://github.com/docker/compose/issues/5089#issuecomment-321822300
# this mappings increase the size of docker image so we use it just in dev, debug mode, in prod its better dockerfile restore just nugets it needs for decresing image size
# here we use full build image for debugging but we change dcoker file `entrypoint` durring `docker run` for for preventing launch app in docker container but with using new entrypoint our stage will run on app working directory and then in our launch.json we launch our app inner container with connecting to `identity-debug` container with `pipeTransport` and `vsdbg` (internaly use dcoker exec and run vsdb on container) and then with using coreclr type and prgram to run, it will run this program with `dotnet run` by coreclr and passed `args`
# https://docs.docker.com/storage/volumes/#use-a-read-only-volume
volumes:
- ~/vsdbg:/vsdbg:ro
- ~/.nuget/packages:/root/.nuget/packages:ro
- ~/.nuget/packages:/home/appuser/.nuget/packages:ro
# https://www.thorsten-hans.com/hot-reload-net-configuration-in-kubernetes-with-configmaps/
# if we need to reload app, we can use volume map for watching our new setting from config-files folder in the the volume or change appsettings.json file in volume map
- src/Services/Customers/FoodDelivery.Services.Customers.Api/${ConfigurationFolder:-config-files/}:/app/config-files/
# https://levelup.gitconnected.com/docker-environment-variables-appsettings-json-net-bdac052bf3db
# https://bartwullems.blogspot.com/2021/03/kubernetesoverride-appsettingsjson-file.html
- ./src/Services/Customers/FoodDelivery.Services.Customers.Api/appsettings.docker.json