Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
Mirrored from https://github.com/Camo67/composio.git
Synced Nov 21, 03:37 UTC
| 1 | # Reusable Dockerfile for Node.js e2e tests |
| 2 | # Usage: docker build -f Dockerfile.node --build-arg NODE_VERSION=22.23.5 --build-arg NODE_VERSION_DIGEST=sha256:e9f565d32859f0cbfb52125eafe8be39390f24dac302dc3cdf566e8ba3ab21ee -t test-name . |
| 3 | # |
| 4 | # Uses official node:slim images. For multi-version testing, run the build/run |
| 5 | # multiple times with different NODE_VERSION values from the shell script. |
| 6 | # |
| 7 | # Base images are digest-pinned for supply-chain integrity. ECR Public mirrors the |
| 8 | # Docker Official Images, so builds do not depend on Docker Hub availability, but |
| 9 | # its anonymous rate limit can still return 429 on shared runner IPs; CI mitigates |
| 10 | # that by retrying with backoff (see .github/actions/build-e2e-image). |
| 11 | # |
| 12 | # bun and pnpm are installed from mise.toml/mise.lock (the single source of truth). |
| 13 | # Node is the test matrix axis and stays on the base image, so it is disabled in |
| 14 | # mise (MISE_DISABLE_TOOLS) to avoid shadowing the base image's Node. |
| 15 | |
| 16 | ARG NODE_VERSION |
| 17 | # Digest pin for the node:${NODE_VERSION}-slim base image; must come from toolchain-versions.json (no default on purpose so builds fail loudly instead of silently floating). |
| 18 | ARG NODE_VERSION_DIGEST |
| 19 | ARG BASE_REGISTRY=public.ecr.aws/docker/library |
| 20 | |
| 21 | # The toolchain stage depends only on the base image and mise.toml/mise.lock, so |
| 22 | # CI saves its layers to the GitHub Actions cache (see .github/actions/build-e2e-image). |
| 23 | FROM ${BASE_REGISTRY}/node:${NODE_VERSION}-slim@${NODE_VERSION_DIGEST} AS toolchain |
| 24 | |
| 25 | ENV MISE_DATA_DIR="/mise" |
| 26 | ENV MISE_CACHE_DIR="/mise/cache" |
| 27 | ENV MISE_DISABLE_TOOLS="node,python,uv" |
| 28 | ENV MISE_TRUSTED_CONFIG_PATHS="/app" |
| 29 | ENV PATH="/mise/shims:$PATH" |
| 30 | |
| 31 | WORKDIR /app |
| 32 | |
| 33 | # Install system dependencies |
| 34 | RUN apt-get update && \ |
| 35 | apt-get install -y --no-install-recommends ca-certificates curl unzip && \ |
| 36 | rm -rf /var/lib/apt/lists/* |
| 37 | |
| 38 | # Install bun + pnpm via mise (versions pinned in mise.toml/mise.lock). |
| 39 | # mise is installed to /usr/local/bin; its shared cache and shims keep the tools |
| 40 | # available to the non-root runtime user. |
| 41 | ENV XDG_CACHE_HOME="/mise/cache" |
| 42 | COPY .github/scripts/install-mise.sh ./.github/scripts/install-mise.sh |
| 43 | RUN MISE_INSTALL_PATH=/usr/local/bin/mise bash .github/scripts/install-mise.sh |
| 44 | COPY mise.toml mise.lock ./ |
| 45 | RUN mise install && \ |
| 46 | pnpm --version && \ |
| 47 | bun --version |
| 48 | |
| 49 | FROM toolchain |
| 50 | |
| 51 | # Copy lockfile first for optimal layer caching |
| 52 | COPY pnpm-lock.yaml ./ |
| 53 | |
| 54 | # Copy workspace configuration files |
| 55 | COPY package.json \ |
| 56 | pnpm-workspace.yaml \ |
| 57 | .pnpmfile.cjs \ |
| 58 | tsconfig.base.json \ |
| 59 | tsdown.config.base.ts \ |
| 60 | toolchain-versions.json \ |
| 61 | ./ |
| 62 | |
| 63 | # pnpm applies these dependency patches during install |
| 64 | COPY patches/ ./patches/ |
| 65 | |
| 66 | # Copy all ts/packages (pre-built) |
| 67 | COPY ts/packages/ ./ts/packages/ |
| 68 | |
| 69 | # Install dependencies using pnpm |
| 70 | # Note: We intentionally don't use --mount=type=cache for the pnpm store here |
| 71 | # because it causes native binding issues (e.g., rolldown-binding) across builds |
| 72 | RUN pnpm install --frozen-lockfile |
| 73 | |
| 74 | # Build and install composio CLI binary |
| 75 | # This is a simplified version of ts/packages/cli/scripts/build-binary.ts + install-binary.ts |
| 76 | WORKDIR /app/ts/packages/cli |
| 77 | RUN bun build ./src/bin.ts \ |
| 78 | --env DEBUG_OVERRIDE_* \ |
| 79 | --compile \ |
| 80 | --production \ |
| 81 | --outfile /usr/local/bin/composio |
| 82 | |
| 83 | WORKDIR /app |
| 84 | |
| 85 | # Copy e2e tests last (changes frequently) |
| 86 | COPY ts/e2e-tests/ ./ts/e2e-tests/ |
| 87 | |
| 88 | RUN chown -R node:node /app |
| 89 | |
| 90 | # Pre-create Composio CLI cache directory to work around Bun issue #7967 |
| 91 | # (Bun-compiled binaries may silently fail to create directories in Docker) |
| 92 | # See: https://github.com/oven-sh/bun/issues/7967 |
| 93 | RUN mkdir -p /home/node/.composio && chown node:node /home/node/.composio |
| 94 | |
| 95 | USER node |
| 96 | |
| 97 | RUN pnpm --version && \ |
| 98 | bun --version |
| 99 | |
| 100 | CMD ["sh"] |