~ knotless Search/
↑↓ move↵ open⇧↵ all results

johnandersen777.bsky.social/asyncai

0
0
main
51 lines · 1.9 KB Raw History
# Dockerfile.windows
#
# Cross-compiles asyncai to self-contained PE32+ x86-64 binaries using the
# mingw-w64 toolchain. Build it from the repo root:
#
#   container build --platform linux/arm64 -m 8G -c 4 \
#     -f Dockerfile.windows -o type=local,dest=$HOME/.tmp/asyncai-win-out .
#
# The build container architecture does not affect the Windows binaries; it
# only needs to run on your machine. Use linux/amd64 on Intel hosts.

FROM rust:1.97-bookworm AS build

RUN apt-get update && apt-get install -y --no-install-recommends \
        gcc-mingw-w64-x86-64 \
        g++-mingw-w64-x86-64 \
        binutils-mingw-w64-x86-64 \
        nasm \
        cmake \
        perl \
        make \
        pkg-config \
        ca-certificates \
    && rm -rf /var/lib/apt/lists/* \
    && rustup target add x86_64-pc-windows-gnu

ENV CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER=x86_64-w64-mingw32-gcc
# Static CRT so the .exe does not need libgcc_s_seh-1.dll/libwinpthread-1.dll.
ENV CARGO_TARGET_X86_64_PC_WINDOWS_GNU_RUSTFLAGS="-C target-feature=+crt-static"

WORKDIR /work
# The image's pinned 1.97.x toolchain is used here; rust-toolchain.toml is
# intentionally not copied so rustup does not switch to a 1.97.0 toolchain
# that lacks the Windows target installed below.
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 \
    cargo build --release --bins --target x86_64-pc-windows-gnu -j 2 && \
    mkdir /out && \
    cp target/x86_64-pc-windows-gnu/release/asyncai.exe \
       target/x86_64-pc-windows-gnu/release/asyncai-mcp-simple.exe \
       target/x86_64-pc-windows-gnu/release/socialweb-computer-kcp-readonly.exe \
       target/x86_64-pc-windows-gnu/release/socialweb-computer-kcp-readwrite.exe \
       /out/

FROM scratch
COPY --from=build /out/ /out/