Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/directory_generators/compose_generator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Hello! It looks like you entered just the letter "M." How can I assist you today?
3 changes: 2 additions & 1 deletion app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
from app.routes.terraform import *
from app.routes.helm import *
from app.routes.ansible import *
from app.routes.jcasc import *
from app.routes.jcasc import *
from app.routes.docker import *
3 changes: 2 additions & 1 deletion app/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
from .terraform_models import *
from .utils import *
from .ansible_models import *
from .jcasc import *
from .jcasc import *
from .compose_models import *
37 changes: 37 additions & 0 deletions app/models/compose_models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
from typing import List, Optional
from pydantic import BaseModel, validator, ValidationError

class Port(BaseModel):
machine_port:int = 80
container_port:int = 80

class Network(BaseModel):
name:str = 'app_network'

class EnvironmentVariable(BaseModel):
name:str = 'foo'
value:str = "bar"

class Volume(BaseModel):
local_dir: str = './nginx/nginx.conf'
container_dir:str = '/etc/nginx/nginx.conf'

class Build(BaseModel):
context:str
dockerfile:str
class Service(BaseModel):
image:str = 'nginx'
container_name:str = 'web_server'
build: Build | None = None
version:str = 'latest'
volumes:List[Volume]
depends_on:List[str]
ports:List[Port]
networks:List[Network]
environments:List[EnvironmentVariable]


class DockerCompose(BaseModel):
services: List[Service]
network:Network

19 changes: 19 additions & 0 deletions app/routes/docker.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from app.app_instance import app
from app.gpt_services import gpt_service
from app.services import (write_installation,edit_directory_generator,execute_pythonfile)
from app.models import (DockerCompose,Output)
from app.template_generators.docker.compose import docker_compose_generator
import os

@app.post("/docker-compose/")
async def docker_compose_template(request:DockerCompose) -> Output:

if os.environ.get("TEST"):
return Output(output='output')
generated_prompt = docker_compose_generator(request)

output = gpt_service(generated_prompt)
edit_directory_generator("compose_generator",output)
execute_pythonfile("MyCompose","compose_generator")
return Output(output='output')

3 changes: 3 additions & 0 deletions app/template_generators/docker/compose.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
def docker_compose_generator(input):
prompt = """M"""
return prompt