-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #117 from abolfazl8131/master
initialize docker compose template generator
- Loading branch information
Showing
6 changed files
with
64 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
def docker_compose_generator(input): | ||
prompt = """M""" | ||
return prompt |