Add initial project setup with Vite, Mantine, and Docker configuration
This commit is contained in:
+22
-7
@@ -1,4 +1,3 @@
|
||||
import os
|
||||
import uuid
|
||||
import shutil
|
||||
import json
|
||||
@@ -7,18 +6,20 @@ import subprocess
|
||||
import petname
|
||||
import hashlib
|
||||
import platform
|
||||
import os
|
||||
from dotenv import load_dotenv
|
||||
from datetime import datetime
|
||||
|
||||
# Archivo JSON para guardar los datos de los contenedores
|
||||
CONTAINER_DATA_FILE = 'containers.json'
|
||||
CONTAINER_DATA_FILE = os.getenv("CONTAINER_DATA_FILE")
|
||||
# Nombre y etiqueta para la imagen base
|
||||
BASE_IMAGE_TAG = 'debian_vscode:tag'
|
||||
BASE_IMAGE_TAG = os.getenv("BASE_IMAGE_TAG")
|
||||
|
||||
#Lita de puertos internos
|
||||
PUERTOS_INTERNOS = [3000, 5000, 8000, 8080, 17000]
|
||||
#Lista de puertos internos
|
||||
PUERTOS_INTERNOS = [5173, 5432, 8786, 8787, 8080, 17000]
|
||||
|
||||
# Numero de conteineres a crear
|
||||
NUM_CONTAINERS = 3
|
||||
NUM_CONTAINERS = 4
|
||||
|
||||
|
||||
|
||||
@@ -26,6 +27,19 @@ NUM_CONTAINERS = 3
|
||||
# Función: Comprobar si un puerto está libre con nmap
|
||||
# -------------------------------
|
||||
def is_port_available(port):
|
||||
# Cargar datos existentes si el archivo existe y no está vacío
|
||||
if os.path.exists(CONTAINER_DATA_FILE) and os.path.getsize(CONTAINER_DATA_FILE) > 0:
|
||||
with open(CONTAINER_DATA_FILE, 'r') as file:
|
||||
try:
|
||||
data = json.load(file) # Cargar datos existentes
|
||||
# Verificar si el puerto ya está en uso en los datos existentes
|
||||
for container in data:
|
||||
for port_map in container['ports']:
|
||||
if port_map['host_port'] == port:
|
||||
return False # Puerto en uso
|
||||
except json.JSONDecodeError:
|
||||
pass # Si hay error al leer, continuar con la comprobación de nmap
|
||||
|
||||
# Ejecuta nmap para comprobar si el puerto está abierto
|
||||
command = f"nmap -p {port} 127.0.0.1"
|
||||
print(f"[INFO] Ejecutando nmap para el puerto {port}...")
|
||||
@@ -111,7 +125,8 @@ services:
|
||||
restart: always
|
||||
tty: true
|
||||
volumes:
|
||||
- ./app:/app
|
||||
- ./share:/app/share
|
||||
- ./d_apps/{container_name}:/app/host_transfer
|
||||
ports:
|
||||
{custom_ports_yaml}
|
||||
command: tail -f /dev/null # Mantener activo el contenedor
|
||||
|
||||
Reference in New Issue
Block a user