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
+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 && \
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/<version>/<os>/<arch>/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.