Skip to content

feat: Docker distribution — Dockerfile + compose with opencode#7

Merged
StatPan merged 1 commit intomainfrom
feat/issue-4-docker
Apr 10, 2026
Merged

feat: Docker distribution — Dockerfile + compose with opencode#7
StatPan merged 1 commit intomainfrom
feat/issue-4-docker

Conversation

@StatPan
Copy link
Copy Markdown
Owner

@StatPan StatPan commented Apr 10, 2026

Closes #4

What

  • Dockerfile — multi-stage build (builder → runner). Produces a minimal image with only dist/ + prod dependencies.
  • docker-compose.yml — two modes:
    • docker compose up agentree — agentree only (connect to existing opencode)
    • docker compose --profile with-opencode up — full stack (opencode + agentree)
  • .dockerignore — excludes node_modules, dist, .env, .git, docs, assets
  • README.md — added Docker section under Quick start

Why

Users who prefer containers can run agentree without Node.js installed. The with-opencode profile handles the "I don't have opencode yet" case.

Test plan

  • pnpm test passes
  • pnpm exec tsc --noEmit passes
  • pnpm exec tsc --noEmit -p tsconfig.client.json passes
  • docker compose build agentree builds successfully
  • docker compose --profile with-opencode up starts both services

@StatPan StatPan merged commit 9662cd4 into main Apr 10, 2026
1 check passed
@StatPan StatPan deleted the feat/issue-4-docker branch April 10, 2026 09:21
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces Docker support by adding a multi-stage Dockerfile, a docker-compose configuration, and updated documentation in the README. The review feedback highlights a critical bug where missing migration files in the runner stage would cause the application to fail at startup, and suggests improvements for container security and service orchestration reliability.

Comment thread Dockerfile
WORKDIR /app
COPY --from=builder /app/package.json /app/pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile --prod
COPY --from=builder /app/dist ./dist
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The application requires the drizzle folder to run database migrations at startup (as seen in src/server/cli.ts). Since the runner stage only copies the dist folder, the migrations will fail. You should copy the migrations folder from the builder stage.

COPY --from=builder /app/dist ./dist
COPY --from=builder /app/drizzle ./drizzle

Comment thread Dockerfile
COPY . .
RUN pnpm run build

FROM node:20-alpine AS runner
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security-medium medium

It is a security best practice to run Docker containers as a non-root user. The node image provides a built-in node user that can be used for this purpose. Ensure that the /app directory and any mounted volumes have the correct permissions for this user.

FROM node:20-alpine AS runner
RUN corepack enable
WORKDIR /app
USER node

Comment thread docker-compose.yml
@@ -0,0 +1,47 @@
services:
agentree:
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

When using the with-opencode profile, the agentree service should wait for the opencode service to be healthy before starting. This prevents agentree from exiting immediately if it cannot connect to opencode during the initial boot sequence.

  agentree:
    build: .
    depends_on:
      opencode:
        condition: service_healthy
        required: false

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Docker distribution — agentree container + compose with opencode

1 participant