fixed syntax for portainer

This commit is contained in:
2025-11-26 18:59:38 -08:00
parent c2c00c0e75
commit c35258d44d
2 changed files with 44 additions and 41 deletions
+13 -10
View File
@@ -126,17 +126,15 @@ def parse_ports(compose_path: Path):
return ports_list return ports_list
# --------------------------------------------------------- # ---------------------------------------------------------
# Parse volumes from docker-compose.yml # Parse volumes from docker-compose.yml
# Returns a list of dicts: {"container": container_path} # Returns a list of dicts: {"container": "/container/path"}
# --------------------------------------------------------- # ---------------------------------------------------------
def parse_volumes(compose_path: Path): def parse_volumes(compose_path: Path):
if not compose_path.exists(): if not compose_path.exists():
return [] return []
volumes_list = [] volumes = []
lines = compose_path.read_text().splitlines() lines = compose_path.read_text().splitlines()
in_volumes = False in_volumes = False
@@ -147,13 +145,18 @@ def parse_volumes(compose_path: Path):
continue continue
if in_volumes: if in_volumes:
if not stripped or not stripped.startswith("-"): if not stripped or not stripped.startswith("-"):
break break # end of volumes section
vol_str = stripped[1:].strip() # remove "- " prefix
parts = vol_str.split(":", 1) volume_str = stripped[1:].strip()
container_path = parts[1] if len(parts) == 2 else parts[0] # split by ':' to separate host path from container path
volumes_list.append({"container": container_path}) parts = volume_str.split(":", 1)
container_path = parts[-1].strip() # take container path only
# remove quotes and inline comments
container_path = container_path.split("#")[0].strip().strip('"').strip("'")
if container_path:
volumes.append({"container": container_path})
return volumes_list return volumes
# --------------------------------------------------------- # ---------------------------------------------------------
# Parse environment variables from sample.env or env-sample # Parse environment variables from sample.env or env-sample
+31 -31
View File
@@ -52,10 +52,10 @@
"ports": [], "ports": [],
"volumes": [ "volumes": [
{ {
"container": "-./data}/website:/data\"" "container": "-./data}/website:/data"
}, },
{ {
"container": "/usr/local/etc/php/php.ini\"" "container": "/usr/local/etc/php/php.ini"
} }
] ]
}, },
@@ -160,7 +160,7 @@
"ports": [], "ports": [],
"volumes": [ "volumes": [
{ {
"container": "-/tmp}/wallabag:/var/www/wallabag/web/assets/images\"" "container": "-/tmp}/wallabag:/var/www/wallabag/web/assets/images"
} }
] ]
}, },
@@ -216,10 +216,10 @@
], ],
"volumes": [ "volumes": [
{ {
"container": "-./data}/thunderbird/config:/config:rw\"" "container": "-./data}/thunderbird/config:/config:rw"
}, },
{ {
"container": "-./data}/thunderbird/export:/export:rw\"" "container": "-./data}/thunderbird/export:/export:rw"
} }
] ]
}, },
@@ -435,10 +435,10 @@
], ],
"volumes": [ "volumes": [
{ {
"container": "/data # Stores raw videos" "container": "/data"
}, },
{ {
"container": "/config # Custom configs" "container": "/config"
} }
] ]
}, },
@@ -518,10 +518,10 @@
"ports": [], "ports": [],
"volumes": [ "volumes": [
{ {
"container": "/etc/timezone:ro\"" "container": "/etc/timezone:ro"
}, },
{ {
"container": "/etc/localtime:ro\"" "container": "/etc/localtime:ro"
} }
] ]
}, },
@@ -603,10 +603,10 @@
], ],
"volumes": [ "volumes": [
{ {
"container": "/etc/pihole'" "container": "/etc/pihole"
}, },
{ {
"container": "/etc/dnsmasq.d'" "container": "/etc/dnsmasq.d"
} }
] ]
}, },
@@ -775,7 +775,7 @@
"ports": [], "ports": [],
"volumes": [ "volumes": [
{ {
"container": "-./data}/nc_data:/usr/app/data\"" "container": "-./data}/nc_data:/usr/app/data"
} }
] ]
}, },
@@ -1333,16 +1333,16 @@
], ],
"volumes": [ "volumes": [
{ {
"container": "-./data}/qbit/config:/config\"" "container": "-./data}/qbit/config:/config"
}, },
{ {
"container": "-./data}/qbit/downloads:/downloads\"" "container": "-./data}/qbit/downloads:/downloads"
}, },
{ {
"container": "-./data}/qbit/incomplete:/incomplete\"" "container": "-./data}/qbit/incomplete:/incomplete"
}, },
{ {
"container": "/dev/net/tun'" "container": "/dev/net/tun"
} }
] ]
}, },
@@ -1486,10 +1486,10 @@
"container": "/var/lib/mysql" "container": "/var/lib/mysql"
}, },
{ {
"container": "/etc/timezone:ro\"" "container": "/etc/timezone:ro"
}, },
{ {
"container": "/etc/localtime:ro\"" "container": "/etc/localtime:ro"
} }
] ]
}, },
@@ -1590,7 +1590,7 @@
"container": "-./data}/codeserver:/data" "container": "-./data}/codeserver:/data"
}, },
{ {
"container": "-./data}/codeserver-config:/config\"" "container": "-./data}/codeserver-config:/config"
} }
] ]
}, },
@@ -1720,22 +1720,22 @@
], ],
"volumes": [ "volumes": [
{ {
"container": "-./data}/handbrake/ghb-config:/config\"" "container": "-./data}/handbrake/ghb-config:/config"
}, },
{ {
"container": "-./data}/handbrake/storage:/storage\"" "container": "-./data}/handbrake/storage:/storage"
}, },
{ {
"container": "-./data}/handbrake/complete:/output\"" "container": "-./data}/handbrake/complete:/output"
}, },
{ {
"container": "-./data}/handbrake/watch:/watch\"" "container": "-./data}/handbrake/watch:/watch"
}, },
{ {
"container": "-./data}/handbrake/watch2:/watch2\"" "container": "-./data}/handbrake/watch2:/watch2"
}, },
{ {
"container": "-./data}/handbrake/trash:/trash\"" "container": "-./data}/handbrake/trash:/trash"
} }
] ]
}, },
@@ -2061,10 +2061,10 @@
"ports": [], "ports": [],
"volumes": [ "volumes": [
{ {
"container": "-./config}/homepage:/app/config # Make sure your local config directory exists" "container": "-./config}/homepage:/app/config"
}, },
{ {
"container": "/var/run/docker.sock # (optional) For docker integrations" "container": "/var/run/docker.sock"
} }
] ]
}, },
@@ -2490,7 +2490,7 @@
"ports": [], "ports": [],
"volumes": [ "volumes": [
{ {
"container": "-./data}/vault-data:/data\"" "container": "-./data}/vault-data:/data"
} }
] ]
}, },
@@ -2633,10 +2633,10 @@
], ],
"volumes": [ "volumes": [
{ {
"container": "-./data}/proxy/data:/data\"" "container": "-./data}/proxy/data:/data"
}, },
{ {
"container": "-./data}/proxy/letsencrypt:/etc/letsencrypt\"" "container": "-./data}/proxy/letsencrypt:/etc/letsencrypt"
} }
] ]
}, },
@@ -3412,7 +3412,7 @@
], ],
"volumes": [ "volumes": [
{ {
"container": "-./data/prowlarr/config}:/config\"" "container": "-./data/prowlarr/config}:/config"
} }
] ]
}, },