1 ARG RUST_BUILDER_IMAGE=ekidd/rust-musl-builder:stable
2 ARG CARGO_BUILD_TARGET=x86_64-unknown-linux-musl
3 ARG RUSTRELEASEDIR="release"
5 FROM $RUST_BUILDER_IMAGE as rust
8 RUN sudo chown -R rust:rust .
10 RUN cargo build --release
13 RUN strip ./target/$CARGO_BUILD_TARGET/$RUSTRELEASEDIR/lemmy_server
15 RUN cp ./target/$CARGO_BUILD_TARGET/$RUSTRELEASEDIR/lemmy_server /app/server/
17 FROM $RUST_BUILDER_IMAGE as docs
19 COPY --chown=rust:rust docs ./docs
20 RUN mdbook build docs/
22 FROM alpine:3.12 as lemmy
24 # Install libpq for postgres
27 # Install Espeak for captchas
30 RUN addgroup -g 1000 lemmy
31 RUN adduser -D -s /bin/sh -u 1000 -G lemmy lemmy
34 COPY --chown=lemmy:lemmy config/defaults.hjson /config/defaults.hjson
35 COPY --chown=lemmy:lemmy --from=rust /app/server/lemmy_server /app/lemmy
36 COPY --chown=lemmy:lemmy --from=docs /app/docs/book/ /app/documentation/
38 RUN chown lemmy:lemmy /app/lemmy