Skip to content

[Feature] Support buildStrategy: "local" for Docker stacks — build the image on the control-plane host and ship it to the target server #535

Description

@ApocalypseYun

Problem

Local build (buildStrategy: "local") works great for app stacks: clone + build on the Openship host, transfer the artifact to the target server. But for docker / docker-compose projects it's hardcoded to "server" (apps/api/src/modules/deployments/build-config.ts), so the full docker build load lands on the target machine.

My setup: the Openship control-plane server is strong (4C/8G), but the business target servers are small (2C/4G). Docker builds (especially npm install inside the image) put real pressure on the small boxes and have caused deploy-time resource exhaustion.

Proposal

Extend buildStrategy: "local" to docker stacks:

  1. Build the image on the API host (docker build with the locally-cloned context)
  2. Transfer it to the target daemon via docker save → stream → docker load
  3. Deploy on the target as usual

The pieces largely exist already:

  • packages/adapters/src/runtime/image-transfer.ts — streams one image between two daemons as pure data (used today for same-server migration handover), no registry needed
  • packages/adapters/src/runtime/local-build.ts — shared local-build pipeline (clone → build → transfer callback)
  • The deploy wizard already has the "This Machine / Server" build-location picker; it would just stop being hidden for docker stacks

Notes / open questions

  • Compose stacks with multiple services: transfer each service's built image
  • Architecture mismatch (e.g. arm64 Mac control plane → amd64 server) would need docker buildx --platform
  • Could reuse handoverImages (one-time image handover used by migration) as the deploy-side seam

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions