1 FROM node:10-jessie as node
6 COPY ui/package.json ui/yarn.lock ./
7 RUN yarn install --pure-lockfile
13 FROM ekidd/rust-musl-builder:nightly-2020-05-07 as rust
17 RUN sudo chown -R rust:rust .
18 RUN USER=root cargo new server
20 # Install cargo-build-deps
21 RUN cargo install --git https://github.com/romac/cargo-build-deps.git
23 RUN mkdir -p lemmy_db/src/ lemmy_utils/src/
25 # Copy the cargo tomls
26 COPY server/Cargo.toml server/Cargo.lock ./
27 COPY server/lemmy_db/Cargo.toml ./lemmy_db/
28 COPY server/lemmy_utils/Cargo.toml ./lemmy_utils/
33 # Copy the src folders
34 COPY server/src ./src/
35 COPY server/lemmy_db/src ./lemmy_db/src/
36 COPY server/lemmy_utils/src/ ./lemmy_utils/src/
37 COPY server/migrations ./migrations/
42 FROM ekidd/rust-musl-builder:nightly-2020-05-07 as docs
45 RUN sudo chown -R rust:rust .
46 RUN mdbook build docs/
50 # Install libpq for postgres
53 # Install Espeak for captchas
57 COPY server/config/defaults.hjson /config/defaults.hjson
58 COPY --from=rust /app/server/target/x86_64-unknown-linux-musl/debug/lemmy_server /app/lemmy
59 COPY --from=docs /app/docs/book/ /app/dist/documentation/
60 COPY --from=node /app/ui/dist /app/dist
62 RUN addgroup -g 1000 lemmy
63 RUN adduser -D -s /bin/sh -u 1000 -G lemmy lemmy
64 RUN chown lemmy:lemmy /app/lemmy