openpencil/Dockerfile
Kayshen Xu efaa56a9e4
V0.4.2 (#46)
* feat(docker): add Docker support with multi-stage build and CI workflow

- Introduced a `.dockerignore` file to exclude unnecessary files from the Docker context.
- Added a `Dockerfile` for multi-stage builds, optimizing the application for production with a slim runtime.
- Created a GitHub Actions workflow (`docker.yml`) to automate the building and pushing of Docker images on version tag pushes.
- Enhanced the `connect-agent.ts` and `install-agent.ts` files to improve OpenCode binary resolution and installation commands.
- Updated the canvas components to support new polygon shape and related functionalities, including UI adjustments for shape tools and appearance settings.

This update significantly enhances the deployment process and expands the application's capabilities with Docker integration.

* feat(docker): enhance Dockerfile with multi-stage builds and CLI variants

- Updated the Dockerfile to include multiple image variants for different CLI tools, including Claude, Codex, OpenCode, and Copilot, alongside the base web app.
- Improved the build process by separating the build stage and production stage, optimizing the final image size.
- Added environment variables and commands for each variant to ensure proper execution in production.
- Enhanced the README files in multiple languages to document the new Docker deployment options and usage instructions.

This update significantly expands the Docker deployment capabilities, allowing users to choose the appropriate image variant based on their needs.
2026-03-17 21:07:50 +08:00

69 lines
2 KiB
Docker

# ── Stage 1: Build web app ──
FROM oven/bun:1 AS builder
WORKDIR /app
COPY package.json bun.lock ./
RUN bun install --frozen-lockfile
COPY . .
RUN bun --bun run build
# ── Stage 2: Base (web only, no CLI) ──
FROM oven/bun:1-slim AS base
WORKDIR /app
COPY --from=builder /app/.output ./.output
COPY --from=builder /app/package.json ./
ENV NODE_ENV=production
ENV NITRO_HOST=0.0.0.0
ENV NITRO_PORT=3000
EXPOSE 3000
CMD ["bun", "run", "./.output/server/index.mjs"]
# ── CLI variants ──
FROM oven/bun:1 AS with-claude
WORKDIR /app
COPY --from=builder /app/.output ./.output
COPY --from=builder /app/package.json ./
RUN bun install -g @anthropic-ai/claude-code
ENV NODE_ENV=production NITRO_HOST=0.0.0.0 NITRO_PORT=3000
EXPOSE 3000
CMD ["bun", "run", "./.output/server/index.mjs"]
FROM oven/bun:1 AS with-codex
WORKDIR /app
COPY --from=builder /app/.output ./.output
COPY --from=builder /app/package.json ./
RUN bun install -g @openai/codex
ENV NODE_ENV=production NITRO_HOST=0.0.0.0 NITRO_PORT=3000
EXPOSE 3000
CMD ["bun", "run", "./.output/server/index.mjs"]
FROM oven/bun:1 AS with-opencode
WORKDIR /app
COPY --from=builder /app/.output ./.output
COPY --from=builder /app/package.json ./
RUN bun install -g opencode-ai
ENV NODE_ENV=production NITRO_HOST=0.0.0.0 NITRO_PORT=3000
EXPOSE 3000
CMD ["bun", "run", "./.output/server/index.mjs"]
FROM oven/bun:1 AS with-copilot
WORKDIR /app
COPY --from=builder /app/.output ./.output
COPY --from=builder /app/package.json ./
RUN bun install -g @github/copilot
ENV NODE_ENV=production NITRO_HOST=0.0.0.0 NITRO_PORT=3000
EXPOSE 3000
CMD ["bun", "run", "./.output/server/index.mjs"]
# ── Full: all CLI tools ──
FROM oven/bun:1 AS full
WORKDIR /app
COPY --from=builder /app/.output ./.output
COPY --from=builder /app/package.json ./
RUN bun install -g @anthropic-ai/claude-code @openai/codex opencode-ai @github/copilot
ENV NODE_ENV=production NITRO_HOST=0.0.0.0 NITRO_PORT=3000
EXPOSE 3000
CMD ["bun", "run", "./.output/server/index.mjs"]