at main 68 lines 1.9 kB view raw
1# Build stage 2FROM rust:1-trixie AS builder 3 4WORKDIR /app 5 6# Pin nightly version for reproducibility 7RUN rustup default nightly-2025-12-04 && rustup component add rust-src llvm-tools-preview --toolchain nightly-2025-12-04 8 9# Install build dependencies 10RUN apt-get update && apt-get install -y \ 11 pkg-config \ 12 libssl-dev \ 13 clang \ 14 llvm \ 15 binutils \ 16 && rm -rf /var/lib/apt/lists/* 17 18# Install wasm target and tools 19RUN rustup target add wasm32-unknown-unknown 20RUN cargo install wasm-bindgen-cli 21 22# Install dioxus-cli 23RUN curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash 24RUN cargo binstall dioxus-cli --root /usr/local -y --force 25 26# Copy source code 27COPY . . 28 29# Use production env for build-time constants 30RUN cp crates/weaver-app/.env-prod crates/weaver-app/.env 31 32# Build wasm workers 33RUN RUSTFLAGS='--cfg getrandom_backend="wasm_js"' cargo build -p weaver-app --bin editor_worker --bin embed_worker \ 34 --target wasm32-unknown-unknown --release \ 35 --no-default-features --features "web","collab-worker","use-index" 36 37# Run wasm-bindgen on workers 38RUN wasm-bindgen target/wasm32-unknown-unknown/release/editor_worker.wasm \ 39 --out-dir crates/weaver-app/public \ 40 --target no-modules \ 41 --no-typescript 42RUN wasm-bindgen target/wasm32-unknown-unknown/release/embed_worker.wasm \ 43 --out-dir crates/weaver-app/public \ 44 --target no-modules \ 45 --no-typescript 46 47# Bundle the app 48RUN dx bundle --verbose --release --debug-symbols false -p weaver-app 49 50# Runtime stage 51FROM debian:trixie-slim 52 53RUN apt-get update && apt-get install -y \ 54 ca-certificates \ 55 libssl3 \ 56 && rm -rf /var/lib/apt/lists/* 57 58WORKDIR /app 59 60# Copy the bundled app 61COPY --from=builder /app/target/dx/weaver-app/release/web/ /app/ 62 63ENV PORT=8080 64ENV IP=0.0.0.0 65 66EXPOSE 8080 67 68ENTRYPOINT ["/app/weaver-app"]