# Multi-stage minimal headless Forma HTTP microservice (< 5 MB final scratch image) FROM rust:1.83-alpine AS builder RUN apk add --no-cache musl-dev WORKDIR /src COPY Cargo.toml Cargo.lock ./ COPY crates ./crates COPY grammar ./grammar RUN RUSTFLAGS="--remap-path-prefix=/root=/home -C target-feature=+crt-static" \ cargo build --locked --profile static-release -p forma-server -p forma-cli FROM scratch COPY --from=builder /src/target/static-release/forma-server /forma-server COPY --from=builder /src/target/static-release/forma /forma ENV FORMA_BIND=0.0.0.0:8080 EXPOSE 8080 ENTRYPOINT ["/forma-server"]