Skip to content

Commit

Permalink
fix(compose): edit default values for documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
abolfazl8131 committed Dec 5, 2024
1 parent 7db40d2 commit b9e4ed1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 27 deletions.
33 changes: 13 additions & 20 deletions app/media/MyCompose/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,50 +1,43 @@
version: '3'
services:
web1:
image: nginx:latest
container_name: web_server
environment:
foo: bar
ports:
- 80:80
networks:
- app_network
web2:
web:
build:
context: .
dockerfile: DockerFile
image: nginx:latest
container_name: web_server
command: string
command: command...
volumes:
- string
- ./foo:bar
environment:
foo: bar
ports:
- 80:80
networks:
- app_network
args:
additionalProp1: string
additionalProp2: string
additionalProp3: string
foo: bar
depends_on:
- string
web3:
- service 0
web2:
build:
context: .
dockerfile: DockerFile
image: nginx:latest
container_name: web_server
command: string
command: command...
volumes:
- string
- ./foo:bar
environment:
foo: bar
ports:
- 80:80
networks:
- app_network
args:
foo: bar
depends_on:
- service 0
networks:
app:
app_network:
driver: bridge
14 changes: 7 additions & 7 deletions app/models/compose_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ class Build(BaseModel):
dockerfile: str = "DockerFile"

class Service(BaseModel):
build: Optional[Build] = None
build: Optional[Build] = Build()
image: Optional[str] = "nginx:latest"
container_name: Optional[str] = "web_server"
command: Optional[str] = None
volumes: Optional[List[str]] = None
command: Optional[str] = "command..."
volumes: Optional[List[str]] = ["./foo:bar"]
environment: Optional[Dict[str, str]] = {"foo":"bar"}
ports: Optional[List[str]] = ["80:80"]
networks: Optional[List[str]] = ["app_network"]
args: Optional[Dict[str, str]] = None
depends_on: Optional[List[str]] = None
args: Optional[Dict[str, str]] = {"foo":"bar"}
depends_on: Optional[List[str]] = ['service 0']

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

class DockerCompose(BaseModel):
version: str = "3"
services: Dict[str, Service]
networks: Optional[Dict[str, Network]]
services: Dict[str, Service] = {"web":Service(), "web2":Service()}
networks: Optional[Dict[str, Network]] = {"app_network": {"driver":"bridge"}}

0 comments on commit b9e4ed1

Please sign in to comment.