diff --git a/install.sh b/install.sh index e8cb540..e8b8493 100644 --- a/install.sh +++ b/install.sh @@ -145,7 +145,7 @@ generate_docker_compose() { fi log_step "Generating docker-compose.yml..." - + local custom_ports_block="" if [ -f ".custom_ports" ]; then while IFS= read -r port_mapping; do @@ -155,6 +155,18 @@ generate_docker_compose() { done < ".custom_ports" fi + # Only include d3v-net if the network already exists (i.e. Forgejo is installed) + local network_block="" + if docker network ls --format '{{.Name}}' 2>/dev/null | grep -q "^${DOCKER_NETWORK}$"; then + network_block=" networks: + - d3v-net + +networks: + d3v-net: + external: true + name: ${DOCKER_NETWORK}" + fi + cat > "$COMPOSE_FILE" <