FROM rust:1.67-alpine3.17 AS builder WORKDIR /build ADD Cargo.toml Cargo.lock src . # Who wrote this idiotic thing? "COPY foo.txt src ." == "COPY foo.txt . ; COPY src/* ." COPY src ./src RUN apk add musl-dev openssl-dev && \ env RUSTFLAGS="-C target-feature=-crt-static" cargo build --release && \ strip target/release/mawby FROM alpine:3.17 COPY --from=builder /build/target/release/mawby /usr/bin/mawby RUN apk add libgcc && \ mkdir -p /var/lib/mawby && \ adduser -u 9823 -h /var/lib/mawby -D mawby mawby && \ chown mawby:mawby /var/lib/mawby USER mawby:mawby VOLUME /etc/mawby VOLUME /var/lib/mawby WORKDIR /var/lib/mawby ENTRYPOINT /usr/bin/mawby