ARG BIN_STAGE=build FROM docker.io/library/rust:1-trixie AS build ARG TRUNK_VERSION=0.21.14 RUN rustup target add wasm32-unknown-unknown \ && curl -sSfL https://github.com/trunk-rs/trunk/releases/download/v${TRUNK_VERSION}/trunk-x86_64-unknown-linux-gnu.tar.gz \ | tar -xz -C /usr/local/bin WORKDIR /src COPY . . RUN cd web && trunk build --release RUN cargo build --release -p server # CI builds the server and web UI itself, puts them in ci-bin/ and selects this # stage with --build-arg BIN_STAGE=prebuilt. An unreferenced stage is not built. FROM scratch AS prebuilt COPY ci-bin/otserver /src/target/release/otserver COPY ci-bin/web /src/web/dist FROM ${BIN_STAGE} AS bin FROM docker.io/library/debian:trixie-slim # webauthn-rs links OpenSSL. RUN apt-get update && apt-get install -y --no-install-recommends libssl3t64 && rm -rf /var/lib/apt/lists/* \ && mkdir /data COPY --from=bin /src/target/release/otserver /usr/local/bin/ COPY --from=bin /src/web/dist /srv/web ENV OT_ADDR=0.0.0.0:8080 OT_DB=/data/ot.db OT_WEB_DIR=/srv/web VOLUME /data EXPOSE 8080 ENTRYPOINT ["otserver"]