dockerfile: single stage, direct CDN download with optional HTTPS_PROXY build-arg
build-and-push / build (push) Successful in 16m42s

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.
This commit is contained in:
Ubuntu
2026-10-23 10:31:49 +00:00
parent c0d758249c
commit 7503bdaa10
2 changed files with 17 additions and 27 deletions
-1
View File
@@ -1,4 +1,3 @@
.env .env
*.log *.log
node_modules/ node_modules/
agent-cache/
+17 -26
View File
@@ -24,33 +24,24 @@ RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
apt-get install -y --no-install-recommends nodejs && \ apt-get install -y --no-install-recommends nodejs && \
rm -rf /var/lib/apt/lists/* rm -rf /var/lib/apt/lists/*
# Build stage for the agent layer. The cursor-agent CLI is pinned at build # cursor-agent CLI, downloaded directly from the Cursor CDN. The version is
# time from the local cache (populated by `agent update` on the build host; # PINNED — the official install script hardcodes the latest version
# CI downloads it once per runner via the same cache path). Keeps # server-side, so we fetch the same package layout ourselves:
# permission/sandbox enforcement current without runtime downloads. # lab/<version>/<os>/<arch>/agent-cli-package.tar.gz
FROM ubuntu:noble AS agent-stage # 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 ARG CURSOR_AGENT_VERSION=2026.10.22-27dcf5f
COPY agent-cache/${CURSOR_AGENT_VERSION} /opt/cursor-agent ARG HTTPS_PROXY=""
RUN if [ -n "$HTTPS_PROXY" ]; then \
FROM ubuntu:noble export HTTPS_PROXY="$HTTPS_PROXY" https_proxy="$HTTPS_PROXY" HTTP_PROXY="$HTTPS_PROXY" http_proxy="$HTTPS_PROXY"; \
fi && \
ENV DEBIAN_FRONTEND=noninteractive mkdir -p /opt/cursor-agent && \
RUN apt-get update && \ curl -fsSL --retry 3 --retry-delay 2 \
apt-get install -y --no-install-recommends \ "https://downloads.cursor.com/lab/${CURSOR_AGENT_VERSION}/linux/x64/agent-cli-package.tar.gz" \
bash \ | tar --strip-components=1 -xzf - -C /opt/cursor-agent && \
ca-certificates \ ln -sf /opt/cursor-agent/cursor-agent /usr/local/bin/cursor-agent && \
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 && \
ln -sf /opt/cursor-agent/cursor-agent /usr/local/bin/agent.real ln -sf /opt/cursor-agent/cursor-agent /usr/local/bin/agent.real
# Application code. # Application code.