diff --git a/Makefile b/Makefile index ddf74174..b151025c 100644 --- a/Makefile +++ b/Makefile @@ -27,7 +27,8 @@ help: @echo " make clean - Clean up processes and temporary files" @echo "" @echo "Docker Production Commands:" - @echo " make up - Build and start production Docker services (localhost:2026)" + @echo " make up - Start production Docker services from existing images (localhost:2026)" + @echo " BUILD=1 make up - Build images then start production Docker services" @echo " make down - Stop and remove production Docker containers" @echo "" @echo "Docker Development Commands:" @@ -183,7 +184,7 @@ docker-logs-gateway: # Production Docker Commands # ========================================== -# Build and start production services +# Start production services (set BUILD=1 to force rebuild) up: @./scripts/deploy.sh diff --git a/docker/docker-compose.yaml b/docker/docker-compose.yaml index 5bfe183f..d3650a5e 100644 --- a/docker/docker-compose.yaml +++ b/docker/docker-compose.yaml @@ -40,6 +40,7 @@ services: # ── Frontend: Next.js Production ─────────────────────────────────────────── frontend: + image: registry.xueai.art/deerflow/deer-flow-frontend:latest build: context: ../ dockerfile: frontend/Dockerfile @@ -60,6 +61,7 @@ services: # ── Gateway API ──────────────────────────────────────────────────────────── gateway: + image: registry.xueai.art/deerflow/deer-flow-gateway:latest build: context: ../ dockerfile: backend/Dockerfile @@ -120,6 +122,7 @@ services: # TODO: switch to langchain/langgraph-api (licensed) once a license key is available. # For now, use `langgraph dev` (no license required) with the standard backend image. langgraph: + image: registry.xueai.art/deerflow/deer-flow-langgraph:latest build: context: ../ dockerfile: backend/Dockerfile diff --git a/scripts/deploy.sh b/scripts/deploy.sh index f30cbcd6..6804d123 100755 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -1,9 +1,11 @@ #!/usr/bin/env bash # -# deploy.sh - Build and start (or stop) DeerFlow production services +# deploy.sh - Start (or stop) DeerFlow production services # # Usage: -# deploy.sh [up] — build images and start containers (default) +# deploy.sh [up] — start containers using existing images (default) +# BUILD=1 deploy.sh [up] — build images then start containers +# deploy.sh push — build and push images to registry.xueai.art/deerflow # deploy.sh down — stop and remove containers # # Must be run from the repo root directory. @@ -172,6 +174,52 @@ if [ "$CMD" = "down" ]; then exit 0 fi +# ── push ────────────────────────────────────────────────────────────────────── + +if [ "$CMD" = "push" ]; then + sandbox_mode="$(detect_sandbox_mode)" + echo -e "${BLUE}Sandbox mode: $sandbox_mode${NC}" + + if [ -z "$DEER_FLOW_DOCKER_SOCKET" ]; then + export DEER_FLOW_DOCKER_SOCKET="/var/run/docker.sock" + fi + + if [ "$sandbox_mode" != "local" ]; then + if [ ! -S "$DEER_FLOW_DOCKER_SOCKET" ]; then + echo -e "${RED}⚠ Docker socket not found at $DEER_FLOW_DOCKER_SOCKET${NC}" + echo " AioSandboxProvider (DooD) build context may not work." + exit 1 + else + echo -e "${GREEN}✓ Docker socket: $DEER_FLOW_DOCKER_SOCKET${NC}" + fi + fi + + REGISTRY_BASE="${REGISTRY_BASE:-registry.xueai.art/deerflow}" + REGISTRY_TAG="${REGISTRY_TAG:-latest}" + PUSH_SERVICES="frontend gateway langgraph" + + echo "" + echo "Building images for push..." + # shellcheck disable=SC2086 + "${COMPOSE_CMD[@]}" build $PUSH_SERVICES + + for service in frontend gateway langgraph; do + local_image="deer-flow-${service}:latest" + remote_image="${REGISTRY_BASE}/deer-flow-${service}:${REGISTRY_TAG}" + echo "Tagging ${local_image} -> ${remote_image}" + docker tag "$local_image" "$remote_image" + echo "Pushing ${remote_image}" + docker push "$remote_image" + done + + echo "" + echo -e "${GREEN}✓ Push complete${NC}" + echo " Registry: ${REGISTRY_BASE}" + echo " Tag: ${REGISTRY_TAG}" + echo "" + exit 0 +fi + # ── Banner ──────────────────────────────────────────────────────────────────── echo "==========================================" @@ -211,13 +259,19 @@ fi echo "" -# ── Step 2: Build and start ─────────────────────────────────────────────────── +# ── Step 2: Start (optionally build) ───────────────────────────────────────── -echo "Building images and starting containers..." +if [ "${BUILD:-0}" = "1" ]; then + echo "BUILD=1 detected: building images and starting containers..." + up_build_flag="--build" +else + echo "Starting containers from existing local images (no build)..." + up_build_flag="" +fi echo "" # shellcheck disable=SC2086 -"${COMPOSE_CMD[@]}" $extra_args up --build -d --remove-orphans $services +"${COMPOSE_CMD[@]}" $extra_args up $up_build_flag -d --remove-orphans $services echo "" echo "=========================================="