added dynamic configuration of API_URL to docker deployments.

Now it works with editing only .env file.
This commit is contained in:
2026-02-25 23:09:50 +01:00
parent 670ea5f970
commit 3a0e751834
15 changed files with 432 additions and 80 deletions
+24 -3
View File
@@ -11,14 +11,35 @@ fi
# Gehe ins Docker-Verzeichnis
cd "$(dirname "$0")"
# Load production environment variables
if [ -f .env.prd ]; then
echo "📝 Loading configuration from .env.prd"
export $(grep -v '^#' .env.prd | xargs)
else
if [ -f .env ]; then
echo "📝 Loading configuration from .env"
export $(grep -v '^#' .env | xargs)
else
echo "⚠️ Warning: .env not found, using defaults"
fi
fi
echo "📦 Building and starting production containers..."
echo "🔧 Frontend will use API: ${API_URL:-https://bamort-api.trokan.de}"
# Build before stopping existing containers
docker-compose -f docker-compose.yml build
docker-compose -f docker-compose.yml --env-file .env.prd build
# Stoppe vorhandene Container
docker-compose -f docker-compose.yml down
# Baue und starte die Container
docker-compose -f docker-compose.yml up --build -d
docker-compose -f docker-compose.yml --env-file .env.prd up -d
echo "✅ Production environment started."
echo "✅ Production environment started."
echo "📱 Frontend: http://localhost:8181"
echo "🔌 Backend: http://localhost:8182"
echo ""
echo "💡 To change API URL: Edit .env.prd and run:"
echo " docker-compose -f docker-compose.yml restart frontend"
echo " (No rebuild needed!)"