swap backend to rust
This commit is contained in:
@ -1,13 +1,27 @@
|
||||
FROM golang:1.24-alpine AS build
|
||||
FROM rust:1.87 AS base
|
||||
RUN cargo install --locked cargo-chef sccache
|
||||
ENV RUSTC_WRAPPER=sccache SCCACHE_DIR=/sccache
|
||||
|
||||
FROM base AS planner
|
||||
WORKDIR /app
|
||||
|
||||
COPY . .
|
||||
RUN go build -o nuchat fergus.molloy.xyz/nuchat
|
||||
RUN cargo chef prepare --recipe-path recipe.json
|
||||
|
||||
FROM scratch
|
||||
FROM base AS builder
|
||||
WORKDIR /app
|
||||
COPY --from=planner /app/recipe.json recipe.json
|
||||
RUN --mount=type=cache,target=/usr/local/cargo/registry \
|
||||
--mount=type=cache,target=/usr/local/cargo/git \
|
||||
--mount=type=cache,target=$SCCACHE_DIR,sharing=locked \
|
||||
cargo chef cook --release --recipe-path recipe.json
|
||||
COPY . .
|
||||
RUN --mount=type=cache,target=/usr/local/cargo/registry \
|
||||
--mount=type=cache,target=/usr/local/cargo/git \
|
||||
--mount=type=cache,target=$SCCACHE_DIR,sharing=locked \
|
||||
cargo build --release --bin nuchat --target-dir=/app/target
|
||||
|
||||
COPY --from=build /app/nuchat .
|
||||
FROM gcr.io/distroless/cc AS runtime
|
||||
WORKDIR /app
|
||||
COPY --from=builder /app/target/release/nuchat ./nuchat
|
||||
|
||||
ENTRYPOINT ["/app/nuchat"]
|
||||
ENTRYPOINT [ "./nuchat", "--host 0.0.0.0" ]
|
||||
|
||||
Reference in New Issue
Block a user