-
Notifications
You must be signed in to change notification settings - Fork 577
feat: add Cursor CLI installation attempts documentation and enhance … #366
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
af39418
2a0719e
bc5a36c
0af5bc8
49f32c4
bd51761
84b582f
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 |
|---|---|---|
|
|
@@ -8,10 +8,12 @@ | |
| # ============================================================================= | ||
| # BASE STAGE - Common setup for all builds (DRY: defined once, used by all) | ||
| # ============================================================================= | ||
| FROM node:22-alpine AS base | ||
| FROM node:22-slim AS base | ||
|
|
||
| # Install build dependencies for native modules (node-pty) | ||
| RUN apk add --no-cache python3 make g++ | ||
| RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
| python3 make g++ \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| WORKDIR /app | ||
|
|
||
|
|
@@ -51,32 +53,59 @@ RUN npm run build:packages && npm run build --workspace=apps/server | |
| # ============================================================================= | ||
| # SERVER PRODUCTION STAGE | ||
| # ============================================================================= | ||
| FROM node:22-alpine AS server | ||
|
|
||
| # Install git, curl, bash (for terminal), su-exec (for user switching), and GitHub CLI (pinned version, multi-arch) | ||
| RUN apk add --no-cache git curl bash su-exec && \ | ||
| GH_VERSION="2.63.2" && \ | ||
| ARCH=$(uname -m) && \ | ||
| case "$ARCH" in \ | ||
| FROM node:22-slim AS server | ||
|
|
||
| # Install git, curl, bash (for terminal), gosu (for user switching), and GitHub CLI (pinned version, multi-arch) | ||
| RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
| git curl bash gosu ca-certificates \ | ||
| && GH_VERSION="2.63.2" \ | ||
| && ARCH=$(uname -m) \ | ||
| && case "$ARCH" in \ | ||
| x86_64) GH_ARCH="amd64" ;; \ | ||
| aarch64|arm64) GH_ARCH="arm64" ;; \ | ||
| *) echo "Unsupported architecture: $ARCH" && exit 1 ;; \ | ||
| esac && \ | ||
| curl -L "https://github.com/cli/cli/releases/download/v${GH_VERSION}/gh_${GH_VERSION}_linux_${GH_ARCH}.tar.gz" -o gh.tar.gz && \ | ||
| tar -xzf gh.tar.gz && \ | ||
| mv gh_${GH_VERSION}_linux_${GH_ARCH}/bin/gh /usr/local/bin/gh && \ | ||
| rm -rf gh.tar.gz gh_${GH_VERSION}_linux_${GH_ARCH} | ||
|
|
||
| # Install Claude CLI globally | ||
| esac \ | ||
| && curl -L "https://github.com/cli/cli/releases/download/v${GH_VERSION}/gh_${GH_VERSION}_linux_${GH_ARCH}.tar.gz" -o gh.tar.gz \ | ||
| && tar -xzf gh.tar.gz \ | ||
| && mv gh_${GH_VERSION}_linux_${GH_ARCH}/bin/gh /usr/local/bin/gh \ | ||
| && rm -rf gh.tar.gz gh_${GH_VERSION}_linux_${GH_ARCH} \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| # Install Claude CLI globally (available to all users via npm global bin) | ||
| RUN npm install -g @anthropic-ai/claude-code | ||
|
|
||
| WORKDIR /app | ||
| # Create non-root user with home directory BEFORE installing Cursor CLI | ||
| RUN groupadd -g 1001 automaker && \ | ||
| useradd -u 1001 -g automaker -m -d /home/automaker -s /bin/bash automaker && \ | ||
| mkdir -p /home/automaker/.local/bin && \ | ||
| mkdir -p /home/automaker/.cursor && \ | ||
| chown -R automaker:automaker /home/automaker && \ | ||
| chmod 700 /home/automaker/.cursor | ||
|
|
||
| # Install Cursor CLI as the automaker user | ||
| # Set HOME explicitly and install to /home/automaker/.local/bin/ | ||
| USER automaker | ||
| ENV HOME=/home/automaker | ||
| RUN curl https://cursor.com/install -fsS | bash && \ | ||
| echo "=== Checking Cursor CLI installation ===" && \ | ||
| ls -la /home/automaker/.local/bin/ && \ | ||
| echo "=== PATH is: $PATH ===" && \ | ||
| (which cursor-agent && cursor-agent --version) || echo "cursor-agent installed (may need auth setup)" | ||
| USER root | ||
|
|
||
| # Create non-root user with home directory | ||
| RUN addgroup -g 1001 -S automaker && \ | ||
| adduser -S automaker -u 1001 -h /home/automaker && \ | ||
| mkdir -p /home/automaker && \ | ||
| chown automaker:automaker /home/automaker | ||
| # Add PATH to profile so it's available in all interactive shells (for login shells) | ||
| RUN mkdir -p /etc/profile.d && \ | ||
| echo 'export PATH="/home/automaker/.local/bin:$PATH"' > /etc/profile.d/cursor-cli.sh && \ | ||
| chmod +x /etc/profile.d/cursor-cli.sh | ||
|
|
||
| # Add to automaker's .bashrc for bash interactive shells | ||
| RUN echo 'export PATH="/home/automaker/.local/bin:$PATH"' >> /home/automaker/.bashrc && \ | ||
| chown automaker:automaker /home/automaker/.bashrc | ||
|
|
||
| # Also add to root's .bashrc since docker exec defaults to root | ||
| RUN echo 'export PATH="/home/automaker/.local/bin:$PATH"' >> /root/.bashrc | ||
|
Comment on lines
+101
to
+106
Contributor
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. To reduce Docker image layers and group related commands, you can combine the |
||
|
|
||
| WORKDIR /app | ||
|
|
||
| # Copy root package.json (needed for workspace resolution) | ||
| COPY --from=server-builder /app/package*.json ./ | ||
|
|
@@ -111,6 +140,8 @@ RUN chmod +x /usr/local/bin/docker-entrypoint.sh | |
| ENV PORT=3008 | ||
| ENV DATA_DIR=/data | ||
| ENV HOME=/home/automaker | ||
| # Add user's local bin to PATH for cursor-agent | ||
| ENV PATH="/home/automaker/.local/bin:${PATH}" | ||
|
|
||
| # Expose port | ||
| EXPOSE 3008 | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -4,8 +4,26 @@ services: | |||||||||||||||||||||
| # Mount your workspace directory to /projects inside the container | ||||||||||||||||||||||
| # Example: mount your local /workspace to /projects inside the container | ||||||||||||||||||||||
| - /Users/webdevcody/Workspace/automaker-workspace:/projects:rw | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| # ===== CLI Authentication (Optional) ===== | ||||||||||||||||||||||
| # Mount host CLI credentials to avoid re-authenticating in container | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| # Claude CLI - mount your ~/.claude directory (Linux/Windows) | ||||||||||||||||||||||
| # This shares your 'claude login' OAuth session with the container | ||||||||||||||||||||||
| # - ~/.claude:/home/automaker/.claude | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| # Cursor CLI - mount your ~/.cursor directory (Linux/Windows) | ||||||||||||||||||||||
| # This shares your 'cursor-agent login' OAuth session with the container | ||||||||||||||||||||||
| # - ~/.cursor:/home/automaker/.cursor | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| environment: | ||||||||||||||||||||||
| # Set root directory for all projects and file operations | ||||||||||||||||||||||
| # Users can only create/open projects within this directory | ||||||||||||||||||||||
| - ALLOWED_ROOT_DIRECTORY=/projects | ||||||||||||||||||||||
| - NODE_ENV=development | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| # ===== macOS Users ===== | ||||||||||||||||||||||
| # On macOS, OAuth tokens are stored in SQLite databases, not plain files. | ||||||||||||||||||||||
| # Extract your Cursor token with: ./scripts/get-cursor-token.sh | ||||||||||||||||||||||
| # Then set it here or in your .env file: | ||||||||||||||||||||||
| # - CURSOR_API_KEY=${CURSOR_API_KEY:-} | ||||||||||||||||||||||
|
Comment on lines
+25
to
+29
Contributor
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. Environment variable name inconsistency. Line 29 references 🔎 Proposed fix # Extract your Cursor token with: ./scripts/get-cursor-token.sh
# Then set it here or in your .env file:
- # - CURSOR_API_KEY=${CURSOR_API_KEY:-}
+ # - CURSOR_AUTH_TOKEN=${CURSOR_AUTH_TOKEN:-}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||
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.
Curl-pipe-to-bash pattern introduces supply chain risk.
Piping remote scripts directly to bash (
curl ... | bash) is a security anti-pattern as it executes arbitrary code without verification. If cursor.com is compromised or serves different content, the build could be affected.Consider:
🤖 Prompt for AI Agents