fix: build WASM before server (include_str! needs wasm-pkg)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -8,20 +8,20 @@ WORKDIR /build
|
|||||||
COPY warzone/Cargo.toml warzone/Cargo.lock ./warzone/
|
COPY warzone/Cargo.toml warzone/Cargo.lock ./warzone/
|
||||||
COPY warzone/crates ./warzone/crates
|
COPY warzone/crates ./warzone/crates
|
||||||
|
|
||||||
# Build server
|
|
||||||
WORKDIR /build/warzone
|
WORKDIR /build/warzone
|
||||||
RUN cargo build --release --bin warzone-server
|
|
||||||
|
|
||||||
# Build WASM (for embedded web client)
|
# Build WASM first (server embeds it via include_str!/include_bytes!)
|
||||||
RUN cargo install wasm-pack && \
|
RUN cargo install wasm-pack && \
|
||||||
wasm-pack build crates/warzone-wasm --target web --out-dir /build/wasm-pkg 2>&1 || true
|
wasm-pack build crates/warzone-wasm --target web --out-dir /build/warzone/wasm-pkg 2>&1 || true
|
||||||
|
|
||||||
|
# Build server (now wasm-pkg exists at the expected relative path)
|
||||||
|
RUN cargo build --release --bin warzone-server
|
||||||
|
|
||||||
# Runtime
|
# Runtime
|
||||||
FROM debian:bookworm-slim
|
FROM debian:bookworm-slim
|
||||||
RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/*
|
RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
COPY --from=builder /build/warzone/target/release/warzone-server /usr/local/bin/
|
COPY --from=builder /build/warzone/target/release/warzone-server /usr/local/bin/
|
||||||
COPY --from=builder /build/wasm-pkg /srv/wasm-pkg
|
|
||||||
|
|
||||||
WORKDIR /data
|
WORKDIR /data
|
||||||
EXPOSE 7700
|
EXPOSE 7700
|
||||||
|
|||||||
Reference in New Issue
Block a user