1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# Linux amd64 build. Build it from the repo root:
#
# container build --platform linux/amd64 -m 8G -c 4 \
# -f Dockerfile -o type=local,dest=$HOME/.tmp/asyncai-out .
#
# Artifacts: <dest>/<platform>/asyncai and the three MCP server binaries.
FROM rust:1.97-alpine AS build
RUN apk add --no-cache build-base ca-certificates cmake perl
WORKDIR /work
# The image's pinned 1.97.x toolchain is used here; rust-toolchain.toml is
# intentionally not copied so rustup does not try to install 1.97.0 inside
# the build container. Local builds still honor the file.
COPY Cargo.toml Cargo.lock ./
COPY src ./src
COPY prompts ./prompts
RUN --mount=type=cache,target=/usr/local/cargo/registry \
--mount=type=cache,target=/usr/local/cargo/git \
--mount=type=cache,target=/work/target \
TOOLCHAIN=$(echo /usr/local/rustup/toolchains/*) && \
PATH="$TOOLCHAIN/bin:$PATH" cargo build --release --bins -j 2 && \
mkdir /out && \
cp target/release/asyncai \
target/release/asyncai-mcp-simple \
target/release/socialweb-computer-kcp-readonly \
target/release/socialweb-computer-kcp-readwrite \
/out/
FROM scratch
COPY --from=build /out/ /out/