FROM rust:latest as builder
RUN rustup target add wasm32-unknown-unknown
WORKDIR /app
COPY . .
RUN cargo build --release --locked
FROM debian:bullseye-slim
RUN groupadd -r appgroup && useradd -r -s /bin/false -g appgroup appuser
COPY --from=builder /app/target/release/harmony-example-rust-webapp /usr/local/bin/harmony-example-rust-webapp
USER appuser
CMD /usr/local/bin/harmony-example-rust-webapp