38 lines
1.0 KiB
Docker
38 lines
1.0 KiB
Docker
FROM rust:1-bookworm AS chef
|
|
|
|
WORKDIR /src
|
|
RUN cargo install cargo-chef --version 0.1.78 --locked \
|
|
&& rustup target add wasm32-unknown-unknown
|
|
|
|
FROM chef AS planner
|
|
|
|
COPY . .
|
|
RUN cargo chef prepare --recipe-path recipe.json
|
|
|
|
FROM chef AS builder
|
|
|
|
ENV SIM_UI_TARGET_DIR=/src/target/ui
|
|
COPY --from=planner /src/recipe.json recipe.json
|
|
RUN cargo chef cook --release --locked --recipe-path recipe.json --bin sim
|
|
RUN cargo chef cook --release --locked --recipe-path recipe.json \
|
|
--package ui --target wasm32-unknown-unknown --target-dir /src/target/ui
|
|
COPY . .
|
|
RUN cargo build --release --locked --bin sim
|
|
|
|
FROM debian:bookworm-slim
|
|
|
|
RUN apt-get update \
|
|
&& apt-get install -y --no-install-recommends ca-certificates \
|
|
&& rm -rf /var/lib/apt/lists/* \
|
|
&& mkdir -p /data
|
|
|
|
COPY --from=builder /src/target/release/sim /usr/local/bin/sim
|
|
COPY --from=builder /src/config.rn /etc/sim/config.rn
|
|
|
|
ENV SIM_ADDR=0.0.0.0:7878
|
|
ENV SHARD_DATABASE_URL=sqlite:///data/sim-shard-{shard}.db?mode=rwc
|
|
ENV SIM_CONFIG=/etc/sim/config.rn
|
|
|
|
VOLUME ["/data"]
|
|
EXPOSE 7878
|
|
CMD ["sim"] |