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
|
- IPAM_POOL=10.8.0.0/16
|
||||||
- GIN_MODE=release
|
- GIN_MODE=release
|
||||||
ports:
|
ports:
|
||||||
- "8080:8080"
|
- "${API_PORT:-8080}:8080"
|
||||||
depends_on:
|
depends_on:
|
||||||
postgres:
|
postgres:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
redis:
|
redis:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
# Requires NET_ADMIN capability for nftables manipulation
|
|
||||||
cap_add:
|
cap_add:
|
||||||
- NET_ADMIN
|
- NET_ADMIN
|
||||||
- NET_RAW
|
- NET_RAW
|
||||||
@@ -62,6 +61,21 @@ services:
|
|||||||
networks:
|
networks:
|
||||||
- nexusnet
|
- 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:
|
volumes:
|
||||||
pgdata:
|
pgdata:
|
||||||
redisdata:
|
redisdata:
|
||||||
|
|||||||
+21
-29
@@ -2,41 +2,33 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
echo "======================================"
|
echo "======================================"
|
||||||
echo " Upgrading NexusGuard SD-WAN Suite "
|
echo " Upgrading NexusGuard SD-WAN Suite... "
|
||||||
echo "======================================"
|
echo "======================================"
|
||||||
|
|
||||||
# Step 1: Docker down
|
# Pastikan file env ada
|
||||||
echo "[+] Stopping Docker containers..."
|
if [ ! -f .env ]; then
|
||||||
docker-compose down --remove-orphans
|
echo "[-] ERROR: .env file not found. Please run ./setup.sh first."
|
||||||
echo "[+] Docker containers stopped."
|
exit 1
|
||||||
|
|
||||||
# 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
|
|
||||||
fi
|
fi
|
||||||
done
|
|
||||||
|
|
||||||
# Step 5: Re-check superproject submodule pointers
|
echo "[+] Pulling latest source code from repository..."
|
||||||
git submodule update --remote --merge 2>/dev/null || true
|
git pull origin main || echo "[!] Git pull skipped or failed, continuing..."
|
||||||
|
|
||||||
# Step 6: Docker up
|
echo "[+] Sourcing environment variables from root .env..."
|
||||||
echo "[+] Starting Docker containers..."
|
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
|
docker-compose up -d
|
||||||
|
|
||||||
|
echo "[+] Cleaning up unused dangling images to free up space..."
|
||||||
|
docker image prune -f
|
||||||
|
|
||||||
echo "======================================"
|
echo "======================================"
|
||||||
echo " NexusGuard upgrade complete! "
|
echo " Upgrade & Rebuild complete! "
|
||||||
echo " API Port : 8080 "
|
echo " Dashboard : http://localhost"
|
||||||
|
echo " API Port : ${API_PORT:-8080}"
|
||||||
echo "======================================"
|
echo "======================================"
|
||||||
|
|||||||
Reference in New Issue
Block a user