fix(deploy): change to sequential builds to reduce QNAP resource contention
This commit is contained in:
+7
-9
@@ -32,23 +32,21 @@ fi
|
|||||||
|
|
||||||
cd "$SOURCE_DIR"
|
cd "$SOURCE_DIR"
|
||||||
|
|
||||||
# เปิด BuildKit เพื่อ layer cache และ parallel build
|
# เปิด BuildKit เพื่อ layer cache
|
||||||
export DOCKER_BUILDKIT=1
|
export DOCKER_BUILDKIT=1
|
||||||
|
|
||||||
# [1/3] Build images (parallel)
|
# [1/3] Build images (sequential to reduce resource contention)
|
||||||
echo "[1/3] Building Docker images (parallel)..."
|
echo "[1/3] Building Docker images (sequential)..."
|
||||||
|
|
||||||
docker build -f backend/Dockerfile -t lcbp3-backend:latest . &
|
echo " Building backend..."
|
||||||
BACKEND_PID=$!
|
docker build -f backend/Dockerfile -t lcbp3-backend:latest . || { echo "✗ Backend build failed!"; exit 1; }
|
||||||
|
|
||||||
|
echo " Building frontend..."
|
||||||
docker build -f frontend/Dockerfile \
|
docker build -f frontend/Dockerfile \
|
||||||
--build-arg NEXT_PUBLIC_API_URL="$API_URL" \
|
--build-arg NEXT_PUBLIC_API_URL="$API_URL" \
|
||||||
--build-arg AUTH_URL="$AUTH_URL" \
|
--build-arg AUTH_URL="$AUTH_URL" \
|
||||||
-t lcbp3-frontend:latest . &
|
-t lcbp3-frontend:latest . || { echo "✗ Frontend build failed!"; exit 1; }
|
||||||
FRONTEND_PID=$!
|
|
||||||
|
|
||||||
wait $BACKEND_PID || { echo "✗ Backend build failed!"; exit 1; }
|
|
||||||
wait $FRONTEND_PID || { echo "✗ Frontend build failed!"; exit 1; }
|
|
||||||
echo "✓ Images built"
|
echo "✓ Images built"
|
||||||
|
|
||||||
# [2/3] Start / restart stack with new images
|
# [2/3] Start / restart stack with new images
|
||||||
|
|||||||
Reference in New Issue
Block a user