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
# Docker compose file used for local development
services:
postgres:
image: postgres:17
ports:
- "5432:5432"
environment:
POSTGRES_DB: test
POSTGRES_USER: test
POSTGRES_PASSWORD: test
# Microsoft SQL database used for testing
mssql:
image: mcr.microsoft.com/mssql/server:2019-CU5-ubuntu-18.04
ports:
- 1433:1433
environment:
- MSSQL_SA_PASSWORD=My@Test@Password1
command:
# Only started when the `devcontainer` profile is active. The dev container
# client brings this service up by name, which auto-activates the profile;
# plain `docker compose up` from the host leaves it untouched.
dev:
profiles:
build:
context: .devcontainer
dockerfile: Dockerfile
volumes:
- .:/workspace
# Share the host's network namespace so localhost:1433 / :5432 reach the
# mssql / postgres services through their published ports — same connection
# strings as on the host, no env-var juggling.
network_mode: host
# Bringing up `dev` also brings up the test databases, so opening the dev
# container leaves you with a complete environment in one step.
depends_on:
- mssql
- postgres