Skip to content

Commit b9e4ed1

Browse files
committed
fix(compose): edit default values for documentation
1 parent 7db40d2 commit b9e4ed1

File tree

2 files changed

+20
-27
lines changed

2 files changed

+20
-27
lines changed
Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,43 @@
11
version: '3'
22
services:
3-
web1:
4-
image: nginx:latest
5-
container_name: web_server
6-
environment:
7-
foo: bar
8-
ports:
9-
- 80:80
10-
networks:
11-
- app_network
12-
web2:
3+
web:
134
build:
145
context: .
156
dockerfile: DockerFile
167
image: nginx:latest
178
container_name: web_server
18-
command: string
9+
command: command...
1910
volumes:
20-
- string
11+
- ./foo:bar
2112
environment:
2213
foo: bar
2314
ports:
2415
- 80:80
2516
networks:
2617
- app_network
2718
args:
28-
additionalProp1: string
29-
additionalProp2: string
30-
additionalProp3: string
19+
foo: bar
3120
depends_on:
32-
- string
33-
web3:
21+
- service 0
22+
web2:
3423
build:
3524
context: .
3625
dockerfile: DockerFile
3726
image: nginx:latest
3827
container_name: web_server
39-
command: string
28+
command: command...
4029
volumes:
41-
- string
30+
- ./foo:bar
4231
environment:
4332
foo: bar
4433
ports:
4534
- 80:80
4635
networks:
4736
- app_network
37+
args:
38+
foo: bar
39+
depends_on:
40+
- service 0
4841
networks:
49-
app:
42+
app_network:
5043
driver: bridge

app/models/compose_models.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ class Build(BaseModel):
66
dockerfile: str = "DockerFile"
77

88
class Service(BaseModel):
9-
build: Optional[Build] = None
9+
build: Optional[Build] = Build()
1010
image: Optional[str] = "nginx:latest"
1111
container_name: Optional[str] = "web_server"
12-
command: Optional[str] = None
13-
volumes: Optional[List[str]] = None
12+
command: Optional[str] = "command..."
13+
volumes: Optional[List[str]] = ["./foo:bar"]
1414
environment: Optional[Dict[str, str]] = {"foo":"bar"}
1515
ports: Optional[List[str]] = ["80:80"]
1616
networks: Optional[List[str]] = ["app_network"]
17-
args: Optional[Dict[str, str]] = None
18-
depends_on: Optional[List[str]] = None
17+
args: Optional[Dict[str, str]] = {"foo":"bar"}
18+
depends_on: Optional[List[str]] = ['service 0']
1919

2020
@model_validator(mode="after")
2121
def validator(self):
@@ -28,6 +28,6 @@ class Network(BaseModel):
2828

2929
class DockerCompose(BaseModel):
3030
version: str = "3"
31-
services: Dict[str, Service]
32-
networks: Optional[Dict[str, Network]]
31+
services: Dict[str, Service] = {"web":Service(), "web2":Service()}
32+
networks: Optional[Dict[str, Network]] = {"app_network": {"driver":"bridge"}}
3333

0 commit comments

Comments
 (0)