forked from devopshobbies/devops-gpt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(compose): compelete compose prompt
- Loading branch information
1 parent
7c593ab
commit 91a80bd
Showing
3 changed files
with
85 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,39 @@ | ||
import os | ||
|
||
project_name = "app/media/MyCompose" | ||
compose_file_path = os.path.join(project_name, "docker-compose.yaml") | ||
|
||
# Create project directories | ||
os.makedirs(project_name, exist_ok=True) | ||
|
||
# Create docker-compose.yaml | ||
with open(compose_file_path, "w") as compose_file: | ||
compose_file.write("version: '3'\n") | ||
compose_file.write("services:\n") | ||
compose_file.write(" web_server:\n") | ||
compose_file.write(" image: nginx:latest\n") | ||
compose_file.write(" volumes:\n") | ||
compose_file.write(" - ./nginx/nginx.conf:/etc/nginx/nginx.conf\n") | ||
compose_file.write(" depends_on:\n") | ||
compose_file.write(" - string\n") | ||
compose_file.write(" ports:\n") | ||
compose_file.write(" - '80:80'\n") | ||
compose_file.write(" environment:\n") | ||
compose_file.write(" - foo=bar\n") | ||
compose_file.write(" networks:\n") | ||
compose_file.write(" - app_network\n") | ||
compose_file.write(" monitoring_server:\n") | ||
compose_file.write(" image: grafana:latest\n") | ||
compose_file.write(" volumes:\n") | ||
compose_file.write(" - ./nginx/nginx.conf:/etc/nginx/nginx.conf\n") | ||
compose_file.write(" depends_on:\n") | ||
compose_file.write(" - string\n") | ||
compose_file.write(" ports:\n") | ||
compose_file.write(" - '82:80'\n") | ||
compose_file.write(" environment:\n") | ||
compose_file.write(" - foo=bar\n") | ||
compose_file.write(" networks:\n") | ||
compose_file.write(" - app_network\n") | ||
compose_file.write("networks:\n") | ||
compose_file.write(" app_network:\n") | ||
compose_file.write(" driver: bridge\n") |
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 |
---|---|---|
@@ -1,4 +1,29 @@ | ||
version: '3' | ||
services: | ||
web_server: | ||
image: nginx:latest | ||
build: | ||
volumes: | ||
- ./nginx/nginx.conf:/etc/nginx/nginx.conf | ||
depends_on: | ||
- string | ||
ports: | ||
- '80:80' | ||
environment: | ||
- foo=bar | ||
networks: | ||
- app_network | ||
monitoring_server: | ||
image: grafana:latest | ||
volumes: | ||
- ./nginx/nginx.conf:/etc/nginx/nginx.conf | ||
depends_on: | ||
- string | ||
ports: | ||
- '82:80' | ||
environment: | ||
- foo=bar | ||
networks: | ||
- app_network | ||
networks: | ||
app_network: | ||
driver: bridge |
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