#!/bin/sh # Baut die Images für deploy/docker-compose.standalone.yml im Host-Netzwerk. # # Für Docker in einem LXC-Container ohne NAT für Docker-Bridge-Netze: Build-Schritte (npm, Google Fonts) erreichen # das Netz nur über das Host-Netzwerk. Docker Compose kann das per "build.network: host" nicht ohne Weiteres # freigeben ("additional privileges requested"), docker build schon. Die Builds laufen nacheinander (schont RAM). # # sh deploy/build.sh [env-datei] # Standard: deploy/.env # docker compose -f deploy/docker-compose.standalone.yml --env-file deploy/.env up -d set -eu cd "$(dirname "$0")/.." ENV_FILE="${1:-deploy/.env}" [ -f "$ENV_FILE" ] || { echo "build: $ENV_FILE nicht gefunden" >&2; exit 1; } # Nur die Proxy-Werte lesen, die Datei nicht als Shell-Skript ausführen. value() { grep -E "^$1=" "$ENV_FILE" | tail -n 1 | cut -d= -f2- || true; } HTTP_PROXY_VALUE="$(value HTTP_PROXY)" HTTPS_PROXY_VALUE="$(value HTTPS_PROXY)" NO_PROXY_VALUE="$(value NO_PROXY)" build() { dockerfile="$1"; tag="$2"; shift 2 echo "build: $tag" docker build --network host \ --build-arg HTTP_PROXY="$HTTP_PROXY_VALUE" --build-arg http_proxy="$HTTP_PROXY_VALUE" \ --build-arg HTTPS_PROXY="$HTTPS_PROXY_VALUE" --build-arg https_proxy="$HTTPS_PROXY_VALUE" \ --build-arg NO_PROXY="$NO_PROXY_VALUE" --build-arg no_proxy="$NO_PROXY_VALUE" \ "$@" -f "$dockerfile" -t "$tag" . } build backend/Dockerfile atm10-stats/backend:latest # Next.js löst den /api-Rewrite beim Build auf: Die API läuft auf demselben Host. build web/Dockerfile atm10-stats/web:latest --build-arg API_INTERNAL_URL=http://127.0.0.1:3001 echo "build: fertig. Starten mit:" echo " docker compose -f deploy/docker-compose.standalone.yml --env-file $ENV_FILE up -d"