From 7503bdaa102ee3ec42fe3ab7151c915369dba63f Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Fri, 23 Oct 2026 10:31:49 +0000 Subject: [PATCH] dockerfile: single stage, direct CDN download with optional HTTPS_PROXY build-arg MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace the local agent-cache COPY trick with a direct pinned download from downloads.cursor.com (same package layout the official installer uses). Optional HTTPS_PROXY build-arg covers egress-constrained build hosts (socks5h:// works — curl honors it); CI runners with direct egress omit it. Drop the now-unneeded agent-stage multi-stage plumbing. --- .gitignore | 1 - Dockerfile | 43 +++++++++++++++++-------------------------- 2 files changed, 17 insertions(+), 27 deletions(-) diff --git a/.gitignore b/.gitignore index 8580091..bb404b1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ .env *.log node_modules/ -agent-cache/ diff --git a/Dockerfile b/Dockerfile index cdbd93c..1301754 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,33 +24,24 @@ RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \ apt-get install -y --no-install-recommends nodejs && \ rm -rf /var/lib/apt/lists/* -# Build stage for the agent layer. The cursor-agent CLI is pinned at build -# time from the local cache (populated by `agent update` on the build host; -# CI downloads it once per runner via the same cache path). Keeps -# permission/sandbox enforcement current without runtime downloads. -FROM ubuntu:noble AS agent-stage +# cursor-agent CLI, downloaded directly from the Cursor CDN. The version is +# PINNED — the official install script hardcodes the latest version +# server-side, so we fetch the same package layout ourselves: +# lab////agent-cli-package.tar.gz +# HTTPS_PROXY is optional: when the build host needs an egress proxy (e.g. +# MTU-blocked direct TLS), build with +# --build-arg HTTPS_PROXY=http://host:port +# CI runners with direct egress simply omit it. ARG CURSOR_AGENT_VERSION=2026.10.22-27dcf5f -COPY agent-cache/${CURSOR_AGENT_VERSION} /opt/cursor-agent - -FROM ubuntu:noble - -ENV DEBIAN_FRONTEND=noninteractive -RUN apt-get update && \ - apt-get install -y --no-install-recommends \ - bash \ - ca-certificates \ - curl \ - tzdata \ - && rm -rf /var/lib/apt/lists/* - -# Node 20 (LTS) — proxy and stdio MCP bridge both run on Node. -RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \ - apt-get install -y --no-install-recommends nodejs && \ - rm -rf /var/lib/apt/lists/* - -# cursor-agent CLI from the pinned build stage. -COPY --from=agent-stage /opt/cursor-agent /opt/cursor-agent -RUN ln -sf /opt/cursor-agent/cursor-agent /usr/local/bin/cursor-agent && \ +ARG HTTPS_PROXY="" +RUN if [ -n "$HTTPS_PROXY" ]; then \ + export HTTPS_PROXY="$HTTPS_PROXY" https_proxy="$HTTPS_PROXY" HTTP_PROXY="$HTTPS_PROXY" http_proxy="$HTTPS_PROXY"; \ + fi && \ + mkdir -p /opt/cursor-agent && \ + curl -fsSL --retry 3 --retry-delay 2 \ + "https://downloads.cursor.com/lab/${CURSOR_AGENT_VERSION}/linux/x64/agent-cli-package.tar.gz" \ + | tar --strip-components=1 -xzf - -C /opt/cursor-agent && \ + ln -sf /opt/cursor-agent/cursor-agent /usr/local/bin/cursor-agent && \ ln -sf /opt/cursor-agent/cursor-agent /usr/local/bin/agent.real # Application code.