FROM --platform=$BUILDPLATFORM ghcr.io/metalbear-co/ci-agent-build:fc6a43e83803b870361cb2ad801d7f0e23d2dd21 AS builder
ARG TARGETARCH
WORKDIR /app
# Prepare platform triple for builds and use a cacheable setup
RUN echo "x86_64-unknown-linux-gnu" > /.platform; \
if [ "$TARGETARCH" = "arm64" ]; then \
echo "aarch64-unknown-linux-gnu" > /.platform; \
elif [ "$TARGETARCH" = "amd64" ]; then \
echo "x86_64-unknown-linux-gnu" > /.platform; \
else \
echo "x86_64-unknown-linux-gnu" > /.platform; \
fi
RUN apt-get update && apt-get install -y mold && rm -rf /var/lib/apt/lists/*
ENV SCCACHE_VERSION=0.14.0
RUN SCCACHE_ARCH=$(case ${TARGETARCH} in \
amd64) echo "x86_64" ;; \
arm64) echo "aarch64" ;; \
*) echo "x86_64" ;; \
esac) && \
curl -fsSL https://github.com/mozilla/sccache/releases/download/v${SCCACHE_VERSION}/sccache-v${SCCACHE_VERSION}-${SCCACHE_ARCH}-unknown-linux-musl.tar.gz \
| tar -xzv --strip-components=1 -C /usr/local/bin sccache-v${SCCACHE_VERSION}-${SCCACHE_ARCH}-unknown-linux-musl/sccache && \
chmod +x /usr/local/bin/sccache
ENV RUSTC_WRAPPER=/usr/local/bin/sccache
ENV RUSTFLAGS="-C link-arg=-fuse-ld=mold"
# Copy workspace
COPY .cargo /app/.cargo
COPY mirrord/macros /app/mirrord/macros
COPY mirrord/tls-util /app/mirrord/tls-util
COPY mirrord/protocol /app/mirrord/protocol
COPY mirrord/agent /app/mirrord/agent
COPY Cargo.toml Cargo.lock CHANGELOG.md README.md LICENSE rust-toolchain.toml /app/
# workspace files requires all members to exist while most of those aren't really needed
# so we remove from the workspace
RUN sed -i '/members = \[/,\]/c\members = [\n "mirrord/*",\n]' /app/Cargo.toml
# Build final binary with sccache and BuildKit cache mounts
RUN --mount=type=cache,target=/usr/local/cargo/registry,id=cargo-registry-agent-$TARGETARCH,sharing=locked \
--mount=type=cache,target=/usr/local/cargo/git,id=cargo-git-agent-$TARGETARCH,sharing=locked \
--mount=type=cache,target=/root/.cache,id=sccache-git-agent-$TARGETARCH,sharing=locked \
--mount=type=cache,target=/app/target,id=target-agent-$TARGETARCH,sharing=locked \
if sccache --start-server; then \
echo "sccache server started"; \
else \
echo "sccache failed to start, continuing without cache"; \
unset RUSTC_WRAPPER; \
fi && \
cargo +nightly-2026-02-24 zigbuild -Z bindeps --manifest-path /app/mirrord/agent/Cargo.toml --target $(cat /.platform) --release && \
echo "sccache stats" && \
(sccache --show-stats || echo "sccache stats unavailable") && \
cp /app/target/$(cat /.platform)/release/mirrord-agent /mirrord-agent
FROM ghcr.io/metalbear-co/ci-agent-runtime:30dca9bcb32306a028178cac371b1e47e403916c
ARG TARGETARCH
WORKDIR /
COPY --from=builder /mirrord-agent /
# Expose a default command that runs the built agent
CMD ["/mirrord-agent"]
FROM ubuntu:22.04
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential curl ca-certificates pkg-config libssl-dev libz-dev \
libsqlite3-dev git unzip cmake zig ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Install Rust via rustup (nightly pinned)
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain nightly-2026-02-24
ENV PATH="/root/.cargo/bin:${PATH}"
# Prepare workspace
WORKDIR /workspace
# Copy source code
COPY . .
# Build mirrord binary (assumes crate named mirrord in workspace, adjust if needed)
RUN --mount=type=cache,target=/root/.cargo/git,id=cargo-git \
--mount=type=cache,target=/root/.cargo/registry,id=cargo-registry \
bash -lc "source /root/.cargo/env; \
cargo +nightly-2026-02-24 build --release -p mirrord" \
&& BIN_PATH=$(bash -lc 'find target -type f -name mirrord -print -quit'); \
if [ -n "$BIN_PATH" ]; then cp "$BIN_PATH" /usr/local/bin/mirrord; fi
ENTRYPOINT ["/usr/local/bin/mirrord"]
.git node_modules target mirrord/agent/target *.log *.tmp *.cache .DS_Store .idea .vscode /build workspace *.tar *.zip ./Dockerfile Cargo.lock
- Exact error message and exit code - E: Unable to locate package zig - Exit code: 100 - Failing command/step - [stage-0 2/6] RUN apt-get update && apt-get install -y --no-install-recommends build-essential curl ca-certificates pkg-config libssl-dev libz-dev libsqlite3-dev git unzip cmake zig ca-certificates && rm -rf /var/lib/apt/lists/* - Missing packages or files mentioned - zig package could not be located in the apt repositories - Version mismatch / environment info - Base image: ubuntu:22.04 (Jammy) as stage-0 - apt sources in use include jammy-security, jammy, jammy-updates, jammy-backports - No explicit version mismatch shown; the failure is due to zig not being available in the repositories for this Ubuntu 22.04 image.
FROM --platform=$BUILDPLATFORM ghcr.io/metalbear-co/ci-agent-build:fc6a43e83803b870361cb2ad801d7f0e23d2dd21 AS builder
ARG TARGETARCH
WORKDIR /app
# Prepare platform triple for builds and use a cacheable setup
RUN echo "$(cat /.platform 2>/dev/null || echo x86_64-unknown-linux-gnu)" > /.platform || true
RUN if [ -z "$(cat /.platform)" ]; then echo x86_64-unknown-linux-gnu > /.platform; fi
RUN echo "Using platform: $(cat /.platform)"
# Install mold and sccache tooling for faster builds
RUN apt-get update && apt-get install -y mold && rm -rf /var/lib/apt/lists/*
ENV SCCACHE_VERSION=0.14.0
RUN SCCACHE_ARCH=$(case ${TARGETARCH} in \
amd64) echo "x86_64" ;; \
arm64) echo "aarch64" ;; \
*) echo "x86_64" ;; \
esac) && \
curl -fsSL https://github.com/mozilla/sccache/releases/download/v${SCCACHE_VERSION}/sccache-v${SCCACHE_VERSION}-${SCCACHE_ARCH}-unknown-linux-musl.tar.gz \
| tar -xzv --strip-components=1 -C /usr/local/bin sccache-v${SCCACHE_VERSION}-${SCCACHE_ARCH}-unknown-linux-musl/sccache && \
chmod +x /usr/local/bin/sccache
ENV RUSTC_WRAPPER=/usr/local/bin/sccache
ENV RUSTFLAGS="-C link-arg=-fuse-ld=mold"
# Copy workspace metadata and crates to enable caching
COPY .cargo /app/.cargo
COPY mirrord/macros /app/mirrord/macros
COPY mirrord/tls-util /app/mirrord/tls-util
COPY mirrord/protocol /app/mirrord/protocol
COPY mirrord/agent /app/mirrord/agent
COPY Cargo.toml Cargo.lock CHANGELOG.md README.md LICENSE rust-toolchain.toml /app/
# workspace files requires all members to exist while most of those aren't really needed
# so we remove from the workspace
RUN sed -i '/members = \[/,\]/c\members = [\n "mirrord/*",\n]' /app/Cargo.toml
# Build final binary with sccache and BuildKit cache mounts
RUN --mount=type=cache,target=/usr/local/cargo/registry,id=cargo-registry-agent-$TARGETARCH,sharing=locked \
--mount=type=cache,target=/usr/local/cargo/git,id=cargo-git-agent-$TARGETARCH,sharing=locked \
--mount=type=cache,target=/root/.cache,id=sccache-git-agent-$TARGETARCH,sharing=locked \
--mount=type=cache,target=/app/target,id=target-agent-$TARGETARCH,sharing=locked \
if sccache --start-server; then \
echo "sccache server started"; \
else \
echo "sccache failed to start, continuing without cache"; \
unset RUSTC_WRAPPER; \
fi && \
cargo +nightly-2026-02-24 zigbuild -Z bindeps --manifest-path /app/mirrord/cli/Cargo.toml --target $(cat /.platform) --release && \
echo "sccache stats" && \
(sccache --show-stats || echo "sccache stats unavailable") && \
# Copy binary out of cached target directory
cp /app/target/$(cat /.platform)/release/mirrord /mirrord
FROM ghcr.io/metalbear-co/ci-agent-runtime:30dca9bcb32306a028178cac371b1e47e403916c
ARG TARGETARCH
WORKDIR /
COPY --from=builder /mirrord /mirrord
CMD ["/mirrord"]
FROM ghcr.io/metalbear-co/ci-agent-build:fc6a43e83803b870361cb2ad801d7f0e23d2dd21 AS builder
ARG TARGETARCH
WORKDIR /app
# Platform triple for cross builds
RUN echo "x86_64-unknown-linux-gnu" > /.platform
RUN if [ "${TARGETARCH}" = "arm64" ]; then echo "aarch64-unknown-linux-gnu" > /.platform; fi
# Copy essential workspace metadata for caching
COPY .cargo /app/.cargo
COPY mirrord/macros /app/mirrord/macros
COPY mirrord/tls-util /app/mirrord/tls-util
COPY mirrord/protocol /app/mirrord/protocol
COPY mirrord/agent /app/mirrord/agent
COPY Cargo.toml Cargo.lock CHANGELOG.md README.md LICENSE rust-toolchain.toml /app/
# Reduce workspace to needed members
RUN sed -i '/members = \[/,\]/c\members = [\n "mirrord/*",\n]' /app/Cargo.toml
# Build the agent component for the given platform
RUN cargo +nightly-2026-02-24 zigbuild -Z bindeps --manifest-path /app/mirrord/agent/Cargo.toml --target $(cat /.platform) --release \
&& cp /app/target/$(cat /.platform)/release/mirrord-agent /mirrord-agent
FROM ghcr.io/metalbear-co/ci-agent-runtime:30dca9bcb32306a028178cac371b1e47e403916c
ARG TARGETARCH
WORKDIR /
COPY --from=builder /mirrord-agent /
CMD ["/mirrord-agent"]
FROM rust:nightly-2026-02-24 AS builder
ARG TARGETARCH
WORKDIR /app
# Install essential build tools
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential pkg-config libssl-dev curl ca-certificates git \
unzip xz-utils && rm -rf /var/lib/apt/lists/*
# Install Zig (needed by zigbuild)
ENV ZIG_VERSION=0.12.0
RUN if [ "$TARGETARCH" = "arm64" ]; then \
ZIG_TARBALL="zig-linux-aarch64-0.12.0.tar.xz"; \
else \
ZIG_TARBALL="zig-linux-x86_64-0.12.0.tar.xz"; \
fi; \
curl -fL -o zig.tar.xz "https://ziglang.org/download/${ZIG_VERSION}/$ZIG_TARBALL" && \
tar -xJf zig.tar.xz -C /usr/local --strip-components=1 && \
rm zig.tar.xz
ENV PATH="/usr/local/bin:${PATH}"
# Platform triple for the build
RUN if [ "$TARGETARCH" = "arm64" ]; then echo aarch64-unknown-linux-gnu > /.platform; else echo x86_64-unknown-linux-gnu > /.platform; fi
# Copy necessary workspace metadata for caching
COPY .cargo /app/.cargo
COPY mirrord/macros /app/mirrord/macros
COPY mirrord/tls-util /app/mirrord/tls-util
COPY mirrord/protocol /app/mirrord/protocol
COPY mirrord/agent /app/mirrord/agent
COPY Cargo.toml Cargo.lock CHANGELOG.md README.md LICENSE rust-toolchain.toml /app/
# Reduce workspace to needed members
RUN sed -i '/members = \[/,\]/c\members = [\n "mirrord/*",\n]' /app/Cargo.toml
# Build the agent component
RUN --mount=type=cache,target=/root/.cargo/registry,id=cargo-registry,sharing=locked \
--mount=type=cache,target=/root/.cargo/git,id=cargo-git,sharing=locked \
bash -lc "source /root/.cargo/env; cargo +nightly-2026-02-24 zigbuild -Z bindeps --manifest-path /app/mirrord/agent/Cargo.toml --target $(cat /.platform) --release && cp /app/target/$(cat /.platform)/release/mirrord-agent /mirrord-agent"
FROM debian:bookworm-slim AS runtime
ARG TARGETARCH
RUN apt-get update && apt-get install -y --no-install-recommends \
libgcc1 libstdc++6 libssl3 ca-certificates \
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder /mirrord-agent /mirrord-agent
RUN chmod +x /mirrord-agent
CMD ["/mirrord-agent"]
FROM rust:latest AS builder
ARG TARGETARCH
WORKDIR /workspace
# Install dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential pkg-config libssl-dev ca-certificates git curl unzip xz-utils \
&& rm -rf /var/lib/apt/lists/*
# Install Zig (for crates that require zigbuild or zig tooling)
ENV ZIG_VERSION=0.12.0
RUN if [ "$TARGETARCH" = "amd64" ]; then \
ZIG_TAR=zig-linux-x86_64-0.12.0.tar.xz; \
else \
ZIG_TAR=zig-linux-aarch64-0.12.0.tar.xz; \
fi; \
curl -fL -o zig.tar.xz "https://ziglang.org/download/${ZIG_VERSION}/${ZIG_TAR}" && \
tar -xJf zig.tar.xz -C /usr/local --strip-components=1 && \
rm zig.tar.xz
ENV PATH="/usr/local/bin:${PATH}"
# Choose a platform triple for potential cross-compiles
RUN echo "${TARGETARCH}" > /.platform
RUN if [ "${TARGETARCH}" = "arm64" ]; then echo aarch64-unknown-linux-gnu > /.platform; else echo x86_64-unknown-linux-gnu > /.platform; fi
# Cache-friendly workspace layout copies
COPY .cargo /workspace/.cargo
COPY Cargo.toml Cargo.lock rust-toolchain.toml /workspace/
COPY mirrord/macros /workspace/mirrord/macros
COPY mirrord/tls-util /workspace/mirrord/tls-util
COPY mirrord/protocol /workspace/mirrord/protocol
COPY mirrord/agent /workspace/mirrord/agent
# Minimal manifest to keep workspace coherent
COPY mirrord/Cargo.toml /workspace/mirrord/Cargo.toml
# Reduce workspace to needed members to speed up cache misses (mirrord/*)
RUN sed -i '/members = \[/,\]/c\members = ["mirrord/*"]' /workspace/Cargo.toml
# Build the workspace
RUN cargo build --workspace --release
FROM debian:bookworm-slim AS runtime
ARG TARGETARCH
WORKDIR /workspace
# Copy the built binaries
COPY --from=builder /workspace/target/release /usr/local/bin
# Default to a shell so the container is usable for inspection
CMD ["/bin/bash"]
Summary (under 1500 chars) - Exit code: not shown in the log (the errors are reported by Docker Buildkit, but no numeric exit code is provided). - Exact error messages: - ERROR: failed to calculate checksum of ref mqpnlh3la2bzegxdamkvycc7g::md60tbn77hqbx4q1dlh5vedzk: "/mirrord/Cargo.toml": not found - ERROR: failed to calculate checksum of ref mqpnlh3la2bzegxdamkvycc7g::md60tbn77hqbx4q1dlh5vedzk: "/Cargo.lock": not found - ERROR: failed to build: failed to solve: failed to compute cache key: failed to calculate checksum of ref mqpnlh3la2bzegxdamkvycc7g::md60tbn77hqbx4q1dlh5vedzk: "/mirrord/Cargo.toml": not found - Failing command/step: - [builder 13/15] COPY mirrord/Cargo.toml /workspace/mirrord/Cargo.toml - [builder 8/15] COPY Cargo.toml Cargo.lock rust-toolchain.toml /workspace/ - Missing files mentioned: - /mirrord/Cargo.toml not found - /Cargo.lock not found - Version mismatch info: - No version mismatch information detected. Images involved: rust:latest and debian:bookworm-slim - Optional note (warning observed): - CopyIgnoredFile: Attempting to Copy file "Cargo.lock" that is excluded by .dockerignore (line 28)
.git node_modules target mirrord/agent/target *.log *.tmp *.cache .DS_Store .idea .vscode /build workspace *.tar *.zip ./Dockerfile
- Exact error message (and exit behavior): ERROR: failed to build: failed to solve: failed to compute cache key: failed to calculate checksum of ref mqpnlh3la2bzegxdamkvycc7g::37jadawy5nxgvqd5xnusqgrds: "/mirrord/Cargo.toml": not found - Failing command/step: COPY mirrord/Cargo.toml /workspace/mirrord/Cargo.toml (builder 13/15; Dockerfile:35) - Missing packages or files mentioned: - Missing file: mirrord/Cargo.toml not found in build context (path: /mirrord/Cargo.toml) - Version mismatch info: - No version mismatch information present in the log. Base images used: rust:latest and debian:bookworm-slim, but no mismatch message is shown.
FROM rust:1.70
WORKDIR /workspace
# Install dependencies for building
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential pkg-config libssl-dev ca-certificates git unzip xz-utils \
&& rm -rf /var/lib/apt/lists/*
# Copy manifest files first to leverage Docker cache
COPY Cargo.toml Cargo.lock rust-toolchain.toml /workspace/
# Copy the rest of the repository
COPY . .
# Build the whole workspace (may take a while)
RUN cargo build --release
# Run a shell by default to allow inspection; a real image could run the built binary if known
CMD ["/bin/bash"]
Summary of Docker build error
- Failing step (command/step)
- [6/6] RUN cargo build --release
- Exact error message and exit code
- exit code: 101
- Error flow excerpt:
- error: failed to run custom build command for `frida-gum-sys v0.17.1`
- Caused by:
- process didn't exit successfully: `/workspace/target/release/build/frida-gum-sys-6c0689b87c024774/build-script-build` (exit status: 101)
- --- stderr
- thread 'main' (12600) panicked at /usr/local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bindgen-0.72.1/lib.rs:616:27:
- Unable to find libclang: "couldn't find any valid shared libraries matching: ['libclang.so', 'libclang-*.so', 'libclang.so.*', 'libclang-*.so.*'], set the `LIBCLANG_PATH` environment variable to a path where one of these files can be found (invalid: [])"
- Missing packages/files mentioned
- libclang libraries are missing / not found in the environment (required by bindgen during the frida-gum-sys build)
- LIBCLANG_PATH needs to point to a valid libclang library location
- Version/mismatch information
- Docker build uses Rust nightly: nightly-2026-02-24-x86_64-unknown-linux-gnu
- Rust toolchain reported: rust version 1.95.0-nightly (b3869b94c 2026-02-23)
- Frida gum devkit download is attempted as part of frida-gum-sys build (log shows: "Frida gum devkit not found, downloading from ..."), but the failure occurs before successful libclang resolution
Notes:
- The root cause is missing libclang for the bindgen step in the frida-gum-sys crate, causing cargo build to fail with exit code 101.FROM --platform=$BUILDPLATFORM rust:nightly-2026-02-24 AS builder
ARG TARGETARCH
WORKDIR /app
# Install dependencies required for building
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential pkg-config libssl-dev clang libclang-dev ca-certificates curl git unzip xz-utils \
&& rm -rf /var/lib/apt/lists/*
# Copy manifest files first to enable Docker cache for dependencies
COPY Cargo.toml Cargo.lock rust-toolchain.toml /app/
# Copy the source tree
COPY . /app/
# Build the mirrord binary (the main workspace crate) in release mode
RUN --mount=type=cache,target=/root/.cargo/registry,id=cargo-registry,sharing=locked \
--mount=type=cache,target=/root/.cargo/git,id=cargo-git,sharing=locked \
bash -lc "source /root/.cargo/env; cargo +nightly-2026-02-24 build --release -p mirrord"
# Copy the built binary to a location accessible in the runtime stage
RUN cp /app/target/release/mirrord /mirrord
FROM debian:bookworm-slim AS runtime
ARG TARGETARCH
RUN apt-get update && apt-get install -y --no-install-recommends \
libssl3 ca-certificates \
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder /mirrord /usr/local/bin/mirrord
RUN chmod +x /usr/local/bin/mirrord
CMD ["mirrord"]
FROM rust:1.70-bullseye AS builder
WORKDIR /work
# Install build dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential pkg-config libssl-dev clang libclang-dev ca-certificates git unzip xz-utils \
&& rm -rf /var/lib/apt/lists/*
# Copy workspace manifests first for better caching
COPY Cargo.toml Cargo.lock rust-toolchain.toml /work/
# Copy the rest of the repo
COPY . /work/
# Build the workspace (this will take a while)
RUN --mount=type=cache,target=/root/.cargo/registry,id=cargo-registry,sharing=locked \
--mount=type=cache,target=/root/.cargo/git,id=cargo-git,sharing=locked \
bash -lc "source /root/.cargo/env; cargo build --release"
# Copy the built binary (if present) to /mirrord for runtime stage
RUN if [ -f /work/target/release/mirrord ]; then cp /work/target/release/mirrord /mirrord; fi
FROM debian:bookworm-slim AS runtime
RUN apt-get update && apt-get install -y --no-install-recommends \
libssl3 ca-certificates \
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder /mirrord /usr/local/bin/mirrord
RUN if [ -x /usr/local/bin/mirrord ]; then echo "mirrord installed"; else echo "mirrord not found or not executable"; fi
CMD ["mirrord"]
Summary of Docker build error
- Failing step:
[builder 6/7] RUN --mount=type=cache,target=/root/.cargo/registry,id=cargo-registry,sharing=locked \
--mount=type=cache,target=/root/.cargo/git,id=cargo-git,sharing=locked \
bash -lc "source /root/.cargo/env; cargo build --release"
- Exact error messages and exit code:
bash: line 1: /root/.cargo/env: No such file or directory
bash: line 1: cargo: command not found
Exit code: 127
(Note: The log shows the final failure as: failed to solve: process "... cargo build --release" did not complete successfully: exit code: 127)
- Missing packages/files mentioned:
- /root/.cargo/env: No such file or directory (environment script for Rust cargo missing)
- cargo: command not found (Cargo binary not available in PATH)
- Version mismatch info:
- No explicit version mismatch reported. The base image is rust:1.70-bullseye, but the error indicates the Rust toolchain (cargo) is not present or not initialized as expected in the build step.FROM ghcr.io/metalbear-co/ci-agent-build:fc6a43e83803b870361cb2ad801d7f0e23d2dd21 AS builder
ARG TARGETARCH
WORKDIR /app
COPY mirrord/agent/platform.sh /app/
RUN ./platform.sh
# this takes around 1 minute since libgit2 is slow
ENV CARGO_NET_GIT_FETCH_WITH_CLI=true
# Install mold linker for faster linking
RUN apt-get update && apt-get install -y mold && rm -rf /var/lib/apt/lists/*
ENV SCCACHE_VERSION=0.14.0
RUN SCCACHE_ARCH=$(case ${TARGETARCH} in \
amd64) echo "x86_64" ;; \
arm64) echo "aarch64" ;; \
*) echo "x86_64" ;; \
esac) && \
curl -fsSL https://github.com/mozilla/sccache/releases/download/v${SCCACHE_VERSION}/sccache-v${SCCACHE_VERSION}-${SCCACHE_ARCH}-unknown-linux-musl.tar.gz \
| tar -xzv --strip-components=1 -C /usr/local/bin sccache-v${SCCACHE_VERSION}-${SCCACHE_ARCH}-unknown-linux-musl/sccache && \
chmod +x /usr/local/bin/sccache
ENV RUSTC_WRAPPER=/usr/local/bin/sccache
ENV RUSTFLAGS="-C link-arg=-fuse-ld=mold"
# Copy workspace metadata and crates
COPY .cargo /app/.cargo
COPY mirrord/macros /app/mirrord/macros
COPY mirrord/tls-util /app/mirrord/tls-util
COPY mirrord/protocol /app/mirrord/protocol
COPY mirrord/agent /app/mirrord/agent
COPY Cargo.toml Cargo.lock CHANGELOG.md README.md LICENSE rust-toolchain.toml /app/
# workspace files requires all members to exist while most of those aren't really needed
# so we remove from the workspace
RUN sed -i '/members = \[/,\]/c\members = [\n "mirrord/*",\n]' /app/Cargo.toml
# Build final binary with sccache and BuildKit cache mounts
RUN --mount=type=cache,target=/usr/local/cargo/registry,id=cargo-registry,sharing=locked \
--mount=type=cache,target=/usr/local/cargo/git,id=cargo-git,sharing=locked \
--mount=type=cache,target=/root/.cache,id=sccache-git,sharing=locked \
--mount=type=cache,target=/app/target,id=target-agent,sharing=locked \
if sccache --start-server; then \
echo "sccache server started"; \
else \
echo "sccache failed to start, continuing without cache"; \
unset RUSTC_WRAPPER; \
fi && \
cargo +nightly-2026-02-24 zigbuild -Z bindeps --manifest-path /app/mirrord/agent/Cargo.toml --target $(cat /.platform) --release && \
echo "sccache stats" && \
(sccache --show-stats || echo "sccache stats unavailable") && \
# Copy binary out of cached target directory
cp /app/target/$(cat /.platform)/release/mirrord-agent /mirrord-agent
FROM ghcr.io/metalbear-co/ci-agent-runtime:30dca9bcb32306a028178cac371b1e47e403916c
ARG TARGETARCH
WORKDIR /
COPY --from=builder /mirrord-agent /
CMD ["./mirrord-agent"]
FROM rust:1.72-bullseye AS builder
WORKDIR /work
# Install build dependencies (minimal)
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential pkg-config libssl-dev clang libclang-dev ca-certificates git curl unzip xz-utils \
&& rm -rf /var/lib/apt/lists/*
# Better networking for cargo
ENV CARGO_NET_GIT_FETCH_WITH_CLI=true
# Copy manifest files to leverage caching for dependencies
COPY Cargo.toml Cargo.lock rust-toolchain.toml /work/
# Copy rest of repository
COPY . /work/
# Build the CLI binary for mirrord from its manifest (likely named mirrord)
RUN --mount=type=cache,target=/root/.cargo/registry,id=cargo-registry,sharing=locked \
--mount=type=cache,target=/root/.cargo/git,id=cargo-git,sharing=locked \
bash -lc "cd /work/mirrord/cli && rustc --version; cargo build --release --manifest-path Cargo.toml --bin mirrord --target x86_64-unknown-linux-gnu || true"
# If built, copy binary to a predictable location
RUN if [ -f /work/mirrord/cli/target/release/mirrord ]; then mkdir -p /mirrord && cp /work/mirrord/cli/target/release/mirrord /mirrord/mirrord; fi
FROM debian:bookworm-slim AS runtime
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates \
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder /mirrord/mirrord /usr/local/bin/mirrord
RUN chmod +x /usr/local/bin/mirrord
CMD ["mirrord"]
- Exact error message and exit code - ERROR: failed to calculate checksum of ref mqpnlh3la2bzegxdamkvycc7g::sxcdwptxo2nrp5cpmlgzba6t4: "/mirrord/mirrord": not found - Exit code: not shown in the log (the line is an error from COPY; non-zero exit implied) - Failing command/step - [runtime 3/4] COPY --from=builder /mirrord/mirrord /usr/local/bin/mirrord - Missing packages or files mentioned - /mirrord/mirrord not found (the copied file does not exist) - During builder step 6/7, rustc and cargo were not found (bash: line 1: rustc: command not found; bash: line 1: cargo: command not found), indicating the Rust toolchain was not available to produce the mirrord binary - Version mismatch info - Builder image uses rust:1.72-bullseye (Debian Bullseye) - Runtime image uses Debian bookworm-slim - The build steps then pull/install packages from bullseye (older Debian) while the runtime base is bookworm (newer Debian), indicating a cross-version mismatch between builder and runtime environments
FROM --platform=$BUILDPLATFORM rust:nightly-2026-02-24 AS builder
WORKDIR /workspace
# Install required build tools
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential pkg-config libssl-dev clang libclang-dev ca-certificates git curl unzip xz-utils \
&& rm -rf /var/lib/apt/lists/*
# Copy manifests first to maximize caching
COPY Cargo.toml Cargo.lock rust-toolchain.toml /workspace/
# Copy the rest of the repository
COPY . /workspace/
# Set up pinned nightly toolchain
ENV RUSTUP_HOME=/usr/local/rustup
ENV CARGO_HOME=/usr/local/cargo
ENV PATH=/usr/local/cargo/bin:/usr/local/rustup/toolchains/nightly-2026-02-24-x86_64-unknown-linux-gnu/bin:${PATH}
RUN rustup set profile minimal
RUN rustup toolchain install nightly-2026-02-24
RUN rustup default nightly-2026-02-24
# Build the workspace
RUN cargo build --release
FROM debian:bookworm-slim AS runtime
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates \
libssl3 \
&& rm -rf /var/lib/apt/lists/*
# Copy the built binary from the builder stage
COPY --from=builder /workspace/target/release/mirrord /usr/local/bin/mirrord
RUN chmod +x /usr/local/bin/mirrord
CMD ["mirrord"]
FROM --platform=$BUILDPLATFORM ghcr.io/metalbear-co/ci-agent-build:fc6a43e83803b870361cb2ad801d7f0e23d2dd21 AS builder
ARG TARGETARCH
WORKDIR /app
COPY ./mirrord/agent/platform.sh /app/
RUN ./platform.sh
# this takes around 1 minute since libgit2 is slow
ENV CARGO_NET_GIT_FETCH_WITH_CLI=true
# Install mold linker for faster linking
RUN apt-get update && apt-get install -y mold && rm -rf /var/lib/apt/lists/*
ENV SCCACHE_VERSION=0.14.0
RUN SCCACHE_ARCH=$(case ${TARGETARCH} in \
amd64) echo "x86_64" ;; \
arm64) echo "aarch64" ;; \
*) echo "x86_64" ;; \
esac) && \
curl -fsSL https://github.com/mozilla/sccache/releases/download/v${SCCACHE_VERSION}/sccache-v${SCCACHE_VERSION}-${SCCACHE_ARCH}-unknown-linux-musl.tar.gz \
| tar -xzv --strip-components=1 -C /usr/local/bin sccache-v${SCCACHE_VERSION}-${SCCACHE_ARCH}-unknown-linux-musdl/sccache && \
chmod +x /usr/local/bin/sccache
ENV RUSTC_WRAPPER=/usr/local/bin/sccache
ENV RUSTFLAGS="-C link-arg=-fuse-ld=mold"
# Copy workspace metadata and crates
COPY .cargo /app/.cargo
COPY mirrord/macros /app/mirrord/macros
COPY mirrord/tls-util /app/mirrord/tls-util
COPY mirrord/protocol /app/mirrord/protocol
COPY mirrord/agent /app/mirrord/agent
COPY Cargo.toml Cargo.lock CHANGELOG.md README.md LICENSE rust-toolchain.toml /app/
# workspace files requires all members to exist while most of those aren't really needed
# so we remove from the workspace
RUN sed -i '/members = \[/,\]/c\members = [\n "mirrord/*",\n]' /app/Cargo.toml
# Build final binary with sccache and BuildKit cache mounts
RUN --mount=type=cache,target=/usr/local/cargo/registry,id=cargo-registry,sharing=locked \
--mount=type=cache,target=/usr/local/cargo/git,id=cargo-git,sharing=locked \
--mount=type=cache,target=/root/.cache,id=sccache-git,sharing=locked \
--mount=type=cache,target=/app/target,id=target-agent,sharing=locked \
if sccache --start-server; then \
echo "sccache server started"; \
else \
echo "sccache failed to start, continuing without cache"; \
unset RUSTC_WRAPPER; \
fi && \
cargo +nightly-2026-02-24 zigbuild -Z bindeps --manifest-path /app/mirrord/agent/Cargo.toml --target $(cat /.platform) --release && \
echo "sccache stats" && \
(sccache --show-stats || echo "sccache stats unavailable") && \
# Copy binary out of cached target directory
cp /app/target/$(cat /.platform)/release/mirrord-agent /mirrord-agent
FROM ghcr.io/metalbear-co/ci-agent-runtime:30dca9bcb32306a028178cac371b1e47e403916c
ARG TARGETARCH
WORKDIR /
COPY --from=builder /mirrord-agent /
CMD ["./mirrord-agent"]
FROM rust:1.72-bullseye AS builder
WORKDIR /work
# Install Rust toolchain (if not present) and useful build tools
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"
# Copy manifests first for better caching
COPY Cargo.toml Cargo.lock rust-toolchain.toml /work/
# Copy the rest of the repo
COPY . /work/
# Build the mirrord crate from the workspace (avoid building the whole workspace if possible)
RUN cargo build --release -p mirrord
# Expose the built binary
RUN cp /work/target/release/mirrord /mirrord
FROM debian:bookworm-slim AS runtime
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates \
libssl3 \
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder /mirrord /usr/local/bin/mirrord
RUN chmod +x /usr/local/bin/mirrord
CMD ["mirrord"]
Summary of Docker build error
- Exact error message and exit code
- Exit code: 101
- Error (from bindgen during cargo build):
thread 'main' (11025) panicked at /usr/local/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bindgen-0.72.1/lib.rs:616:27:
Unable to find libclang: "couldn't find any valid shared libraries matching: ['libclang.so', 'libclang-*.so', 'libclang.so.*', 'libclang-*.so.*'], set the `LIBCLANG_PATH` environment variable to a path where one of these files can be found (invalid: [])"
- Failing command/step
- [builder 6/7] RUN cargo build --release -p mirrord
- Missing packages or files mentioned
- libclang libraries are not present (bindgen cannot locate libclang)
- LIBCLANG_PATH is not set
- The runtime apt-get install in the Dockerfile installs ca-certificates, libssl3, openssl, but not libclang/clang dev libraries
- Version mismatch info
- The failure is tied to bindgen version: 0.72.1 (lib.rs:616:27). The issue is missing libclang libraries, not a direct code version mismatch. No other explicit version mismatches shown.FROM ubuntu:22.04 AS builder
# Install essential build tools
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential curl ca-certificates git pkg-config libssl-dev libbz2-dev zlib1g-dev \
unzip ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Install rustup and pinned nightly toolchain
ENV RUSTUP_HOME=/root/.rustup
ENV CARGO_HOME=/root/.cargo
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain nightly-2026-02-24
ENV PATH=/root/.cargo/bin:${PATH}
WORKDIR /app
# Copy only the medschool crate to leverage caching
COPY medschool /app/medschool
# Build medschool binary from source
RUN --mount=type=cache,target=/root/.cargo/registry,id=cargo-registry,sharing=locked \
--mount=type=cache,target=/root/.cargo/git,id=cargo-git,sharing=locked \
bash -lc "cd /app/medschool && cargo build --release"
FROM debian:bookworm-slim AS runtime
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Copy the built binary from the builder stage
COPY --from=builder /app/medschool/target/release/medschool /usr/local/bin/medschool
RUN chmod +x /usr/local/bin/medschool
CMD ["medschool"]
Error summary
- Exact error message and exit code:
- error: failed to parse manifest at `/app/medschool/Cargo.toml`
- Caused by:
- error inheriting `edition` from workspace root manifest's `workspace.package.edition`
- Caused by:
- failed to find a workspace root
- Exit code: 101
- Failing command/step:
- Dockerfile builder step:
RUN --mount=type=cache,target=/root/.cargo/registry,id=cargo-registry,sharing=locked \
--mount=type=cache,target=/root/.cargo/git,id=cargo-git,sharing=locked \
bash -lc "cd /app/medschool && cargo build --release"
- Missing packages or files mentioned:
- /app/medschool/Cargo.toml (manifest) failed to parse due to workspace/root configuration
- Indicates missing/incorrect workspace root manifest (workspace root not found)
- Version mismatch info (relevant details from log):
- Rust toolchain installed for this build: nightly-2026-02-24-x86_64-unknown-linux-gnu
- rustc version: 1.95.0-nightly (b3869b94c 2026-02-23)# Build the mirrord workspace from source and produce a reusable runtime image.
# Builder stage: use a Rust toolchain with cargo to build the workspace.
FROM --platform=$BUILDPLATFORM rust:1.75-bullseye AS builder
WORKDIR /workspace
# System dependencies needed for building Rust crates and optional cross-tools.
# We install common build tools, OpenSSL headers, Zig for Zig-based builds, and Mold for faster linking.
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential \
pkg-config \
clang \
libclang-dev \
libssl-dev \
zig \
mold \
&& rm -rf /var/lib/apt/lists/*
# Enable cargo git fetch caching (mirrors the CI env as in the repo)
ENV CARGO_NET_GIT_FETCH_WITH_CLI=true
# Copy entire repository (order could be optimized for caching, but simplicity first)
COPY . .
# Build the workspace from source. Use a pinned nightly if needed by the repository's crates.
# Building all workspace members can be heavy; this aims to produce mirrord and mirrord-agent binaries.
RUN rustc --version && cargo +nightly-2026-02-24 --version || true
RUN cargo +nightly-2026-02-24 build --release
# Runtime stage: a lightweight Debian-based image with only runtime deps
FROM debian:bookworm-slim as runtime
ARG TARGETARCH
# Install runtime dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates \
libssl3 \
&& rm -rf /var/lib/apt/lists/*
# Copy built binaries from builder. Assume workspace binary names are mirrord and mirrord-agent.
COPY --from=builder /workspace/target/release/mirrord /usr/local/bin/mirrord
COPY --from=builder /workspace/target/release/mirrord-agent /usr/local/bin/mirrord-agent
# Create a non-root user for security
RUN useradd -m appuser
USER appuser
WORKDIR /home/appuser
# Default command runs the main mirrord CLI
CMD ["mirrord"]
# Build the mirrord workspace from source and produce a reusable runtime image.
# Builder stage: use a Rust toolchain with cargo to build the workspace.
FROM rust:1.75-bullseye AS builder
WORKDIR /workspace
# System dependencies needed for building Rust crates and optional cross-tools.
# We install common build tools, Zig for Zig-based builds, and Mold for faster linking.
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential \
pkg-config \
clang \
libclang-dev \
libssl-dev \
zig \
mold \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Enable cargo git fetch caching (mirrors the CI env as in the repo)
ENV CARGO_NET_GIT_FETCH_WITH_CLI=true
# Install the nightly toolchain used by ZigBuild in this repository
RUN rustup toolchain install nightly-2026-02-24 && \
rustup default nightly-2026-02-24
# Copy the repository
COPY . .
# Build the workspace from source. Use a pinned nightly for zigbuild time.
RUN rustc --version && \
cargo +nightly-2026-02-24 zigbuild -Z bindeps --manifest-path mirrord/cli/Cargo.toml --target x86_64-unknown-linux-gnu --release && \
cargo +nightly-2026-02-24 zigbuild -Z bindeps --manifest-path mirrord/agent/Cargo.toml --target x86_64-unknown-linux-gnu --release
# Copy built binaries to a common location
RUN mkdir -p /usr/local/bin
RUN cp /workspace/target/x86_64-unknown-linux-gnu/release/* /usr/local/bin/
# Runtime stage: a lightweight Debian-based image with only runtime deps
FROM debian:bookworm-slim as runtime
ARG TARGETARCH
# Install runtime dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates \
libssl3 \
&& rm -rf /var/lib/apt/lists/*
# Copy built binaries from builder
COPY --from=builder /usr/local/bin/* /usr/local/bin/
# Create a non-root user for security
RUN useradd -m appuser
USER appuser
WORKDIR /home/appuser
# Default command runs the main mirrord CLI (the CLI binary is named mirrord)
CMD ["mirrord"]
# Ignore cargo and build artifacts and VCS metadata target/ **/target/ Cargo.lock .git node_modules/ *.log .DS_Store *.idea *.vscode *.cache .
Exact error message and exit code - E: Unable to locate package zig - E: Unable to locate package mold - The build failed with exit code: 100 Failing command/step - [builder 3/8] RUN apt-get update && apt-get install -y --no-install-recommends build-essential pkg-config clang libclang-dev libssl-dev zig mold ca-certificates && rm -rf /var/lib/apt/lists/* Missing packages or files mentioned - zig - mold Version mismatch info - Builder base image: rust:1.75-bullseye (Bullseye) - Runtime base image: debian:bookworm-slim (Bookworm) - The failing apt install occurs in the Bullseye-based builder stage, where zig and mold are not locatable in that apt repository. This indicates a version mismatch between base images and available packages.