All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 10s
43 lines
1.2 KiB
Docker
43 lines
1.2 KiB
Docker
FROM node:24-alpine AS node-builder
|
|
WORKDIR /app
|
|
COPY ui/package-lock.json .
|
|
COPY ui/package.json .
|
|
RUN npm install
|
|
|
|
COPY ui .
|
|
RUN npm run 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 cargo chef prepare --recipe-path recipe.json
|
|
|
|
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
|
|
|
|
FROM gcr.io/distroless/cc AS runtime
|
|
|
|
WORKDIR /app
|
|
|
|
ADD --chmod=a+x vendor/busybox_WGET /usr/bin/wget
|
|
COPY --from=node-builder /app/dist dist
|
|
COPY --from=builder /app/target/release/nuchat .
|
|
|
|
# HEALTHCHECK --interval=5s --retries=1 --timeout=5s CMD ["wget", "-q", "--spider", "http://localhost:7000/healthcheck
|
|
|
|
ENTRYPOINT [ "/app/nuchat", "--host", "0.0.0.0" ]
|