Containerfile
⎇
Raw
1ARG BIN_STAGE=build
2
3FROM docker.io/library/rust:1-trixie AS build
4ARG TRUNK_VERSION=0.21.14
5RUN rustup target add wasm32-unknown-unknown \
6 && curl -sSfL https://github.com/trunk-rs/trunk/releases/download/v${TRUNK_VERSION}/trunk-x86_64-unknown-linux-gnu.tar.gz \
7 | tar -xz -C /usr/local/bin
8WORKDIR /src
9COPY . .
10RUN cd web && trunk build --release
11RUN cargo build --release -p server
12
13# CI builds the server and web UI itself, puts them in ci-bin/ and selects this
14# stage with --build-arg BIN_STAGE=prebuilt. An unreferenced stage is not built.
15FROM scratch AS prebuilt
16COPY ci-bin/otserver /src/target/release/otserver
17COPY ci-bin/web /src/web/dist
18
19FROM ${BIN_STAGE} AS bin
20
21FROM docker.io/library/debian:trixie-slim
22# webauthn-rs links OpenSSL.
23RUN apt-get update && apt-get install -y --no-install-recommends libssl3t64 && rm -rf /var/lib/apt/lists/* \
24 && useradd --system --uid 10001 ot && mkdir /data && chown ot /data
25COPY --from=bin /src/target/release/otserver /usr/local/bin/
26COPY --from=bin /src/web/dist /srv/web
27ENV OT_ADDR=0.0.0.0:8080 OT_DB=/data/ot.db OT_WEB_DIR=/srv/web
28USER ot
29VOLUME /data
30EXPOSE 8080
31ENTRYPOINT ["otserver"]
32