zed/crates/eval_cli/Dockerfile
Kirill Bulatov 1271f8b0e8
Some checks failed
extension_auto_bump / detect_changed_extensions (push) Has been cancelled
extension_auto_bump / bump_extension_versions (push) Has been cancelled
Congratsbot / check-author (push) Waiting to run
Congratsbot / congrats (push) Blocked by required conditions
deploy_nightly_docs / deploy_docs (push) Waiting to run
run_tests / check_workspace_binaries (push) Blocked by required conditions
run_tests / orchestrate (push) Waiting to run
run_tests / check_style (push) Waiting to run
run_tests / clippy_windows (push) Blocked by required conditions
run_tests / clippy_linux (push) Blocked by required conditions
run_tests / build_visual_tests_binary (push) Blocked by required conditions
run_tests / check_wasm (push) Blocked by required conditions
run_tests / check_dependencies (push) Blocked by required conditions
run_tests / check_scripts (push) Blocked by required conditions
run_tests / check_postgres_and_protobuf_migrations (push) Blocked by required conditions
run_tests / extension_tests (push) Blocked by required conditions
run_tests / tests_pass (push) Blocked by required conditions
run_tests / clippy_mac (push) Blocked by required conditions
run_tests / clippy_mac_x86_64 (push) Blocked by required conditions
run_tests / run_tests_windows (push) Blocked by required conditions
run_tests / run_tests_linux (push) Blocked by required conditions
run_tests / run_tests_mac (push) Blocked by required conditions
run_tests / miri_scheduler (push) Blocked by required conditions
run_tests / doctests (push) Blocked by required conditions
run_tests / check_docs (push) Blocked by required conditions
run_tests / check_licenses (push) Blocked by required conditions
Bump rustc to 1.97 (#62395)
Release Notes:

- N/A
2026-08-09 22:29:52 +00:00

52 lines
2 KiB
Docker

# Build eval-cli for Linux.
#
# Usage (from the zed repo root):
# docker build --platform linux/amd64 -f crates/eval_cli/Dockerfile -t eval-cli-builder .
# docker cp "$(docker create eval-cli-builder)":/eval-cli ./target/eval-cli
#
# Or use the helper script:
# crates/eval_cli/script/build-linux
FROM rust:1.97.1@sha256:3382bd20aa942806c533e9a73cd000474fb3ef173f71e684cc9b942675781769 AS builder
ARG CARGO_ZIGBUILD_VERSION=0.22.3
WORKDIR /app
# Pre-install the toolchain specified in rust-toolchain.toml so it is cached.
RUN rustup toolchain install 1.97.1 --profile minimal \
--component rustfmt --component clippy --component rust-analyzer --component rust-src \
--target wasm32-wasip2 --target wasm32-unknown-unknown --target x86_64-unknown-linux-musl --target x86_64-unknown-linux-gnu
# Install build tools. cmake + build-essential are needed for vendored C
# libraries (libgit2-sys, zstd-sys, libsqlite3-sys). No audio/GUI -dev
# packages required — eval-cli runs headless with those features disabled.
#
# cargo-zigbuild cross-compiles against musl libc, producing a fully
# static binary that runs on any Linux distro (glibc or musl / Alpine).
RUN apt-get update && apt-get install -y --no-install-recommends \
cmake \
build-essential \
curl \
xz-utils \
&& rm -rf /var/lib/apt/lists/*
RUN mkdir -p /opt/zig \
&& curl -fsSL https://ziglang.org/download/0.15.2/zig-x86_64-linux-0.15.2.tar.xz \
| tar -xJ -C /opt/zig --strip-components=1 \
&& ln -s /opt/zig/zig /usr/local/bin/zig
RUN cargo install --locked cargo-zigbuild --version ${CARGO_ZIGBUILD_VERSION}
COPY . .
RUN --mount=type=cache,target=/usr/local/cargo/registry \
--mount=type=cache,target=/usr/local/cargo/git \
--mount=type=cache,target=/app/target \
cargo zigbuild --release --package eval_cli \
--target x86_64-unknown-linux-musl && \
cp /app/target/x86_64-unknown-linux-musl/release/eval-cli /eval-cli && \
strip /eval-cli
FROM scratch
COPY --from=builder /eval-cli /eval-cli