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