sub2api/deploy/Dockerfile.ls
win 21325afb33
Some checks failed
CI / test (push) Failing after 10s
CI / frontend (push) Failing after 8s
CI / golangci-lint (push) Failing after 5s
Security Scan / backend-security (push) Failing after 5s
Security Scan / frontend-security (push) Failing after 4s
feat(windsurf): 补全ops日志记录与endpoint派生,对齐其他平台
- windsurf_gateway_service: 添加上游延迟/TTFT/错误上下文记录
- endpoint: DeriveUpstreamEndpoint 添加 PlatformWindsurf 分支
- ops_error_logger: guessPlatformFromPath 添加 /windsurf/ 识别
2026-04-23 20:46:27 +08:00

77 lines
2.5 KiB
Docker

# Windsurf Language Server Docker Image
#
# Usage (host network — required for CSRF loopback check):
# docker build -t windsurf-ls -f deploy/Dockerfile.ls .
# docker run -d --name windsurf-ls \
# --network host \
# -v windsurf_ls_data:/data \
# windsurf-ls
#
# The LS binary is auto-downloaded from Exafunction/codeium releases at build time.
# To use a local binary instead, pass --build-arg LS_URL=file:///path or place it
# at deploy/language_server_linux_x64 and rebuild.
FROM alpine:3.21 AS downloader
RUN apk add --no-cache curl jq
ARG TARGETARCH
ARG LS_URL=""
RUN set -e; \
if [ -n "$LS_URL" ]; then \
echo "Downloading LS from: $LS_URL"; \
curl -fL --progress-bar -o /tmp/language_server "$LS_URL"; \
else \
case "$TARGETARCH" in \
amd64) ASSET="language_server_linux_x64" ;; \
arm64) ASSET="language_server_linux_arm" ;; \
*) echo "Unsupported arch: $TARGETARCH"; exit 1 ;; \
esac; \
echo "Fetching latest Exafunction/codeium release..."; \
URL=$(curl -fsSL https://api.github.com/repos/Exafunction/codeium/releases/latest \
| jq -r --arg asset "$ASSET" '.assets[] | select(.name == $asset) | .browser_download_url'); \
if [ -z "$URL" ] || [ "$URL" = "null" ]; then \
echo "ERROR: Could not find asset $ASSET in latest release"; exit 1; \
fi; \
echo "Downloading: $URL"; \
curl -fL --progress-bar -o /tmp/language_server "$URL"; \
fi; \
chmod +x /tmp/language_server
FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates netcat-openbsd && \
rm -rf /var/lib/apt/lists/*
WORKDIR /opt/windsurf
COPY --from=downloader /tmp/language_server /opt/windsurf/language_server_linux_x64
RUN mkdir -p /data/db
ENV LS_PORT=42099 \
LS_CSRF_TOKEN=ad2d9f01-4e7b-8c3a-b5f6-1d8e9a0c7b2f \
LS_API_SERVER_URL=https://server.self-serve.windsurf.com \
HTTPS_PROXY="" \
HTTP_PROXY=""
EXPOSE ${LS_PORT}
HEALTHCHECK --interval=10s --timeout=3s --start-period=15s --retries=3 \
CMD nc -z localhost ${LS_PORT} || exit 1
ENTRYPOINT ["/bin/sh", "-c", \
"exec /opt/windsurf/language_server_linux_x64 \
--api_server_url=${LS_API_SERVER_URL} \
--server_port=${LS_PORT} \
--csrf_token=${LS_CSRF_TOKEN} \
--register_user_url=https://api.codeium.com/register_user/ \
--codeium_dir=/data \
--database_dir=/data/db \
--enable_local_search=false \
--enable_index_service=false \
--enable_lsp=false \
--detect_proxy=false"]