# syntax=docker/dockerfile:1 # knotless-serve and the web pages it hands on to, in one image: the # compose file in deploy/ runs it twice, once as each. # # docker build -t knotless:current . FROM rust:1-bookworm AS serve WORKDIR /src COPY . . # The cache mounts keep the registry and the build between builds on the # same machine, so a change rebuilds the crates it touches and not the rest. RUN --mount=type=cache,target=/usr/local/cargo/registry \ --mount=type=cache,target=/src/target \ cargo build --release --locked -p knotless-serve --bin knotless-serve \ && cp target/release/knotless-serve /knotless-serve FROM node:24-bookworm-slim AS pages WORKDIR /web COPY web/package.json web/package-lock.json ./ RUN npm ci --no-audit --no-fund COPY web/ ./ RUN npm run build # adapter-node bundles what the pages import, so the build needs no # node_modules beside it. FROM node:24-bookworm-slim RUN apt-get update \ && apt-get install -y --no-install-recommends git ca-certificates tini \ && rm -rf /var/lib/apt/lists/* COPY --from=serve /knotless-serve /usr/local/bin/knotless-serve COPY --from=pages /web/build /app/build COPY --from=pages /web/package.json /app/package.json USER node ENTRYPOINT ["tini", "--"] CMD ["knotless-serve", "--listen", "0.0.0.0:2590"]