-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Docker distribution — Dockerfile + compose with opencode #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| node_modules/ | ||
| dist/ | ||
| *.db | ||
| *.db-shm | ||
| *.db-wal | ||
| .env | ||
| .env.* | ||
| .git/ | ||
| .github/ | ||
| assets/ | ||
| docs/ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| FROM node:20-alpine AS builder | ||
| RUN corepack enable | ||
| WORKDIR /app | ||
| COPY package.json pnpm-lock.yaml ./ | ||
| RUN pnpm install --frozen-lockfile | ||
| COPY . . | ||
| RUN pnpm run build | ||
|
|
||
| FROM node:20-alpine AS runner | ||
| RUN corepack enable | ||
| WORKDIR /app | ||
| COPY --from=builder /app/package.json /app/pnpm-lock.yaml ./ | ||
| RUN pnpm install --frozen-lockfile --prod | ||
| COPY --from=builder /app/dist ./dist | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The application requires the |
||
|
|
||
| ENV PORT=3001 | ||
| EXPOSE 3001 | ||
| CMD ["node", "dist/server/cli.js"] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| services: | ||
| agentree: | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When using the agentree:
build: .
depends_on:
opencode:
condition: service_healthy
required: false |
||
| build: . | ||
| ports: | ||
| - "${AGENTREE_PORT:-3001}:3001" | ||
| environment: | ||
| OPENCODE_API_URL: ${OPENCODE_API_URL:-http://opencode:6543} | ||
| OPENCODE_SERVER_USERNAME: ${OPENCODE_SERVER_USERNAME:-opencode} | ||
| OPENCODE_SERVER_PASSWORD: ${OPENCODE_SERVER_PASSWORD:-} | ||
| DB_PATH: /data/agentree.db | ||
| volumes: | ||
| - agentree_data:/data | ||
| restart: unless-stopped | ||
|
|
||
| opencode: | ||
| profiles: [with-opencode] | ||
| image: ${OPENCODE_IMAGE:-ghcr.io/anomalyco/opencode:latest} | ||
| environment: | ||
| HOME: /root | ||
| OPENCODE_CONFIG_DIR: /root/.config/opencode | ||
| OPENCODE_SERVER_PASSWORD: ${OPENCODE_SERVER_PASSWORD:-} | ||
| OPENCODE_SERVER_USERNAME: ${OPENCODE_SERVER_USERNAME:-opencode} | ||
| OPENCODE_DISABLE_AUTOUPDATE: ${OPENCODE_DISABLE_AUTOUPDATE:-1} | ||
| OPENCODE_DISABLE_LSP_DOWNLOAD: ${OPENCODE_DISABLE_LSP_DOWNLOAD:-0} | ||
| OPENCODE_EXPERIMENTAL: ${OPENCODE_EXPERIMENTAL:-0} | ||
| TZ: ${TZ:-UTC} | ||
| volumes: | ||
| - ${OPENCODE_WORKSPACE_DIR:-.}:/workspace | ||
| - ${OPENCODE_CONFIG_HOST_DIR:-opencode_config}:/root/.config/opencode | ||
| - ${OPENCODE_DATA_HOST_DIR:-opencode_data}:/root/.local/share/opencode | ||
| ports: | ||
| - "${OPENCODE_PORT:-6543}:6543" | ||
| working_dir: /workspace | ||
| restart: unless-stopped | ||
| init: true | ||
| command: ["serve", "--hostname", "0.0.0.0", "--port", "6543"] | ||
| healthcheck: | ||
| test: ["CMD-SHELL", "wget -qO- http://127.0.0.1:6543/global/health >/dev/null 2>&1"] | ||
| interval: 20s | ||
| timeout: 5s | ||
| retries: 5 | ||
| start_period: 20s | ||
|
|
||
| volumes: | ||
| agentree_data: | ||
| opencode_config: | ||
| opencode_data: | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a security best practice to run Docker containers as a non-root user. The
nodeimage provides a built-innodeuser that can be used for this purpose. Ensure that the/appdirectory and any mounted volumes have the correct permissions for this user.