1FROM rust:1 AS chef 2RUN cargo install cargo-chef 3WORKDIR /app 4 5FROM chef AS planner 6COPY . . 7RUN cargo chef prepare --recipe-path recipe.json 8 9 10FROM chef AS builder 11COPY --from=planner /app/recipe.json recipe.json 12RUN cargo chef cook --release --recipe-path recipe.json 13COPY . . 14 15# Install `dx` 16RUN curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash 17RUN cargo binstall dioxus-cli --root /.cargo -y --force 18ENV PATH="/.cargo/bin:$PATH" 19 20# Create the final bundle folder. Bundle always executes in release mode with optimizations enabled 21RUN cd crates/weaver-server && dx bundle --release 22 23FROM chef AS runtime 24 25 26COPY --from=builder /app/target/dx/weaver-server/release/web/ /usr/local/app 27 28# set our port and make sure to listen for all connections 29ENV PORT=8080 30ENV IP=0.0.0.0 31 32# expose the port 8080 33EXPOSE 8080 34 35WORKDIR /usr/local/app 36ENTRYPOINT [ "/usr/local/app/weaver-server" ]