1 ARG RUST_BUILDER_IMAGE=ekidd/rust-musl-builder:stable
3 FROM $RUST_BUILDER_IMAGE as rust
5 ARG RUSTRELEASEDIR="release"
9 RUN cargo build --release
12 RUN strip ./target/$CARGO_BUILD_TARGET/$RUSTRELEASEDIR/lemmy_server
14 RUN cp ./target/$CARGO_BUILD_TARGET/$RUSTRELEASEDIR/lemmy_server /app/server/
16 FROM $RUST_BUILDER_IMAGE as docs
18 COPY --chown=rust:rust docs ./docs
19 RUN mdbook build docs/
21 FROM alpine:3.12 as lemmy
23 # Install libpq for postgres
26 # Install Espeak for captchas
29 RUN addgroup -g 1000 lemmy
30 RUN adduser -D -s /bin/sh -u 1000 -G lemmy lemmy
33 COPY --chown=lemmy:lemmy config/defaults.hjson /config/defaults.hjson
34 COPY --chown=lemmy:lemmy --from=rust /app/server/lemmy_server /app/lemmy
35 COPY --chown=lemmy:lemmy --from=docs /app/docs/book/ /app/documentation/
37 RUN chown lemmy:lemmy /app/lemmy