FROM rust:1.95 AS builder
WORKDIR /app
# Cache dependency compilation
COPY Cargo.toml Cargo.lock ./
COPY src ./src
RUN cargo build --release --example ws_echo_server --features ws,s3-sync 2>&1 | tail -1
# Build the ws_echo_server example
COPY examples ./examples
RUN cargo build --release --example ws_echo_server --features ws,s3-sync
FROM debian:trixie-slim
COPY --from=builder /app/target/release/examples/ws_echo_server /app/ws_echo_server
EXPOSE 443
CMD ["/app/ws_echo_server"]