diff --git a/app/media/MyCompose/docker-compose.yaml b/app/media/MyCompose/docker-compose.yaml index 19cb7613..27640329 100644 --- a/app/media/MyCompose/docker-compose.yaml +++ b/app/media/MyCompose/docker-compose.yaml @@ -1,23 +1,14 @@ 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: @@ -25,26 +16,28 @@ services: 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 diff --git a/app/models/compose_models.py b/app/models/compose_models.py index 62e409f7..9f53a9f5 100644 --- a/app/models/compose_models.py +++ b/app/models/compose_models.py @@ -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): @@ -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"}}