2 FROM ekidd/rust-musl-builder:1.50.0 as builder
4 ARG CARGO_BUILD_TARGET=x86_64-unknown-linux-musl
5 ARG RUSTRELEASEDIR="release"
11 RUN sudo chown -R rust:rust .
12 RUN cargo build --release
15 RUN strip ./target/$CARGO_BUILD_TARGET/$RUSTRELEASEDIR/lemmy_server
17 RUN cp ./target/$CARGO_BUILD_TARGET/$RUSTRELEASEDIR/lemmy_server /app/lemmy_server
20 FROM alpine:3.12 as lemmy
22 # Install libpq for postgres
25 RUN addgroup -g 1000 lemmy
26 RUN adduser -D -s /bin/sh -u 1000 -G lemmy lemmy
29 COPY --chown=lemmy:lemmy --from=builder /app/lemmy_server /app/lemmy
31 RUN chown lemmy:lemmy /app/lemmy