diff --git a/.devcontainer/codespaces/Dockerfile b/.devcontainer/codespaces/Dockerfile new file mode 100644 index 00000000000..524f8ffcf45 --- /dev/null +++ b/.devcontainer/codespaces/Dockerfile @@ -0,0 +1,27 @@ +ARG NODE_VERSION=24 + +# Debian, not Alpine: Playwright browsers and the agent CLIs need glibc +FROM node:${NODE_VERSION}-bookworm + +ARG PLAYWRIGHT_VERSION=1.60.0 + +RUN apt-get update && apt-get install -y --no-install-recommends \ + tmux sudo less jq ripgrep postgresql-client \ + && rm -rf /var/lib/apt/lists/* + +# Chromium system libs baked into the image; browser binaries install per-user in onCreate +RUN npx -y playwright@${PLAYWRIGHT_VERSION} install-deps chromium + +# Agent harnesses. Self-update is off: the image is the update mechanism +ENV DISABLE_AUTOUPDATER=1 +RUN npm install -g @anthropic-ai/claude-code opencode-ai + +RUN echo node ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/node && chmod 0440 /etc/sudoers.d/node +RUN mkdir -p /workspaces && chown node:node /workspaces +RUN corepack enable + +ENV PNPM_HOME=/home/node/.local/share/pnpm +ENV PATH=$PNPM_HOME/bin:$PATH + +USER node +RUN mkdir -p $PNPM_HOME ~/.pnpm-store && pnpm config set store-dir ~/.pnpm-store --global diff --git a/.devcontainer/codespaces/devcontainer.json b/.devcontainer/codespaces/devcontainer.json new file mode 100644 index 00000000000..46c4c784a60 --- /dev/null +++ b/.devcontainer/codespaces/devcontainer.json @@ -0,0 +1,25 @@ +{ + "name": "n8n (Codespaces agent sessions)", + "dockerComposeFile": "docker-compose.yml", + "service": "n8n", + "workspaceFolder": "/workspaces", + "hostRequirements": { + "cpus": 8, + "memory": "32gb", + "storage": "64gb" + }, + "features": { + "ghcr.io/devcontainers/features/github-cli:1": {} + }, + "forwardPorts": [8080, 5678], + // Runs in prebuilds, so a fresh codespace starts with deps installed and the build warm + "onCreateCommand": "corepack install && pnpm install && (pnpm build > /tmp/build.log 2>&1 || tail -n 50 /tmp/build.log) && pnpm --filter=n8n-playwright exec playwright install chromium", + "secrets": { + "ANTHROPIC_API_KEY": { + "description": "Anthropic API key for Claude Code / OpenCode sessions" + }, + "CLAUDE_CODE_OAUTH_TOKEN": { + "description": "Alternative to an API key: token from `claude setup-token` (Max subscription)" + } + } +} diff --git a/.devcontainer/codespaces/docker-compose.yml b/.devcontainer/codespaces/docker-compose.yml new file mode 100644 index 00000000000..3ab32136ada --- /dev/null +++ b/.devcontainer/codespaces/docker-compose.yml @@ -0,0 +1,26 @@ +volumes: + postgres-data: + +services: + postgres: + image: postgres:16-alpine + restart: unless-stopped + volumes: + - postgres-data:/var/lib/postgresql/data + environment: + - POSTGRES_DB=n8n + - POSTGRES_PASSWORD=password + + n8n: + build: + context: . + dockerfile: Dockerfile + volumes: + - ../..:/workspaces:cached + command: sleep infinity + depends_on: + - postgres + environment: + DB_POSTGRESDB_HOST: postgres + DB_TYPE: postgresdb + DB_POSTGRESDB_PASSWORD: password