Skip to content

docker building and chat/workspace creation problem #219

@ember-zhang

Description

@ember-zhang

Summary

Fix Docker self-host build/runtime regressions after the desktop package split.

After pulling latest main, docker compose up -d --build failed in Docker, while local macOS pnpm dev still worked.

Problems

1. Docker build fails because desktop package is built in server image

Recent changes moved Electron into apps/desktop and added apps/* to pnpm-workspace.yaml.

The Dockerfile still ran:

pnpm build

which expands to turbo run build and now includes @traderalice/desktop.

Inside Docker, apps/desktop/package.json is not copied before pnpm install, so Electron dependencies are missing. Build fails with:

@traderalice/desktop:build: src/main.ts(22,36): error TS2307: Cannot find module 'electron'

The self-host Docker image does not need to build the Electron desktop package, so the Docker build should exclude @traderalice/desktop.

2. Docker runtime cannot create Chat/Workspace because git is missing

After the image builds and starts, creating a Chat or Workspace fails with:

bootstrap script exited with code 127
/app/src/workspaces/templates/chat/bootstrap.sh: line 29: git: command not found

The runtime image only installs tini, but workspace bootstrap scripts call git init, git commit, and some templates use git clone.

This only affects Docker. Local macOS pnpm dev works because git is available on the host.

Fix

Update Dockerfile:

  1. Replace pnpm build with the server-image build steps:
  pnpm build:migration-index \
    && pnpm exec turbo run build --filter='!@traderalice/desktop' \
    && pnpm exec tsup src/main.ts --format esm --dts
  1. Install runtime bootstrap dependencies:
  RUN apt-get update && apt-get install -y --no-install-recommends \
          ca-certificates \
          git \
          tini \
      && rm -rf /var/lib/apt/lists/*

ca-certificates is included so templates that clone HTTPS repositories work reliably in the slim runtime image.

Verification

Tested with:

  docker compose up -d --build
  docker compose exec -T openalice git --version
  docker compose exec -T openalice bash -lc 'rm -rf /tmp/oa-bootstrap-test-chat; AQ_TEMPLATE_FILES_DIR=/app/src/workspaces/templates/chat/files AQ_TEMPLATE_ROOT=/app/src/workspaces/templates/chat AQ_LAUNCHER_REPO_ROOT=/app /app/src/
  workspaces/templates/chat/bootstrap.sh test-chat /tmp/oa-bootstrap-test-chat'

Results:

git version 2.47.3
bootstrapped chat workspace 'test-chat' at /tmp/oa-bootstrap-test-chat

OpenAlice starts successfully and Chat/Workspace bootstrap no longer fails with code 127.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions