2 FROM ekidd/rust-musl-builder:1.51.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 echo "pub const VERSION: &str = \"$(git describe --tag)\";" > "crates/utils/src/version.rs"
13 RUN cargo build --release
16 RUN strip ./target/$CARGO_BUILD_TARGET/$RUSTRELEASEDIR/lemmy_server
18 RUN cp ./target/$CARGO_BUILD_TARGET/$RUSTRELEASEDIR/lemmy_server /app/lemmy_server
21 FROM alpine:3.12 as lemmy
23 # Install libpq for postgres
26 RUN addgroup -g 1000 lemmy
27 RUN adduser -D -s /bin/sh -u 1000 -G lemmy lemmy
30 COPY --chown=lemmy:lemmy --from=builder /app/lemmy_server /app/lemmy
32 RUN chown lemmy:lemmy /app/lemmy