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:1.42.0-openssl11 as rust
17 RUN sudo chown -R rust:rust .
18 RUN USER=root cargo new server
20 RUN mkdir -p lemmy_db/src/ lemmy_utils/src/
21 COPY server/Cargo.toml server/Cargo.lock ./
22 COPY server/lemmy_db/Cargo.toml ./lemmy_db/
23 COPY server/lemmy_utils/Cargo.toml ./lemmy_utils/
24 RUN mkdir -p ./src/bin \
25 && echo 'fn main() { println!("Dummy") }' > ./src/bin/main.rs \
26 && cp ./src/bin/main.rs ./lemmy_db/src/main.rs \
27 && cp ./src/bin/main.rs ./lemmy_utils/src/main.rs
29 RUN rm -f ./target/x86_64-unknown-linux-musl/debug/deps/lemmy_server*
30 COPY server/src ./src/
31 COPY server/lemmy_db ./lemmy_db/
32 COPY server/lemmy_utils ./lemmy_utils/
33 COPY server/migrations ./migrations/
38 FROM ekidd/rust-musl-builder:1.42.0-openssl11 as docs
41 RUN sudo chown -R rust:rust .
42 RUN mdbook build docs/
46 # Install libpq for postgres
49 # Install Espeak for captchas
53 COPY server/config/defaults.hjson /config/defaults.hjson
54 COPY --from=rust /app/server/target/x86_64-unknown-linux-musl/debug/lemmy_server /app/lemmy
55 COPY --from=docs /app/docs/book/ /app/dist/documentation/
56 COPY --from=node /app/ui/dist /app/dist
58 RUN addgroup -g 1000 lemmy
59 RUN adduser -D -s /bin/sh -u 1000 -G lemmy lemmy
60 RUN chown lemmy:lemmy /app/lemmy