feat(devops): unify frontend docker build and root env injection
This commit is contained in:
+1
-1
Submodule apps/dashboard-ui updated: 924c811d53...344f513ea5
+16
-2
@@ -48,13 +48,12 @@ services:
|
||||
- IPAM_POOL=10.8.0.0/16
|
||||
- GIN_MODE=release
|
||||
ports:
|
||||
- "8080:8080"
|
||||
- "${API_PORT:-8080}:8080"
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_healthy
|
||||
# Requires NET_ADMIN capability for nftables manipulation
|
||||
cap_add:
|
||||
- NET_ADMIN
|
||||
- NET_RAW
|
||||
@@ -62,6 +61,21 @@ services:
|
||||
networks:
|
||||
- nexusnet
|
||||
|
||||
dashboard-ui:
|
||||
build:
|
||||
context: ./apps/dashboard-ui
|
||||
dockerfile: Dockerfile
|
||||
args:
|
||||
# Inject the root .env variable into the frontend build process
|
||||
VITE_API_BASE_URL: ${VITE_API_BASE_URL}
|
||||
ports:
|
||||
- "80:80"
|
||||
depends_on:
|
||||
- server-core
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- nexusnet
|
||||
|
||||
volumes:
|
||||
pgdata:
|
||||
redisdata:
|
||||
|
||||
+21
-29
@@ -2,41 +2,33 @@
|
||||
set -e
|
||||
|
||||
echo "======================================"
|
||||
echo " Upgrading NexusGuard SD-WAN Suite "
|
||||
echo " Upgrading NexusGuard SD-WAN Suite... "
|
||||
echo "======================================"
|
||||
|
||||
# Step 1: Docker down
|
||||
echo "[+] Stopping Docker containers..."
|
||||
docker-compose down --remove-orphans
|
||||
echo "[+] Docker containers stopped."
|
||||
|
||||
# Step 2: Git pull main repo
|
||||
echo "[+] Pulling latest main repo..."
|
||||
git pull
|
||||
|
||||
# Step 3: Update submodules
|
||||
echo "[+] Updating submodules..."
|
||||
git submodule update --init --recursive
|
||||
|
||||
# Step 4: Submodule checkout — pull latest main on each
|
||||
for sub in apps/server-core apps/device-agent apps/dashboard-ui; do
|
||||
if [ -d "$sub" ]; then
|
||||
echo "[+] Updating $sub..."
|
||||
cd "$sub"
|
||||
git checkout main 2>/dev/null || git checkout master 2>/dev/null || true
|
||||
git pull
|
||||
cd - > /dev/null
|
||||
# Pastikan file env ada
|
||||
if [ ! -f .env ]; then
|
||||
echo "[-] ERROR: .env file not found. Please run ./setup.sh first."
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
# Step 5: Re-check superproject submodule pointers
|
||||
git submodule update --remote --merge 2>/dev/null || true
|
||||
echo "[+] Pulling latest source code from repository..."
|
||||
git pull origin main || echo "[!] Git pull skipped or failed, continuing..."
|
||||
|
||||
# Step 6: Docker up
|
||||
echo "[+] Starting Docker containers..."
|
||||
echo "[+] Sourcing environment variables from root .env..."
|
||||
export $(grep -v '^#' .env | xargs)
|
||||
|
||||
echo "[+] Rebuilding Docker images (injecting new environment variables)..."
|
||||
# Menggunakan --build-arg untuk memastikan Vue/Vite membaca domain API baru
|
||||
docker-compose build --build-arg VITE_API_BASE_URL=$VITE_API_BASE_URL
|
||||
|
||||
echo "[+] Restarting containers..."
|
||||
docker-compose up -d
|
||||
|
||||
echo "[+] Cleaning up unused dangling images to free up space..."
|
||||
docker image prune -f
|
||||
|
||||
echo "======================================"
|
||||
echo " NexusGuard upgrade complete! "
|
||||
echo " API Port : 8080 "
|
||||
echo " Upgrade & Rebuild complete! "
|
||||
echo " Dashboard : http://localhost"
|
||||
echo " API Port : ${API_PORT:-8080}"
|
||||
echo "======================================"
|
||||
|
||||
Reference in New Issue
Block a user