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.38.0-openssl11 as rust
17 RUN sudo chown -R rust:rust .
18 RUN USER=root cargo new server
20 COPY server/Cargo.toml server/Cargo.lock ./
21 RUN sudo chown -R rust:rust .
22 RUN mkdir -p ./src/bin \
23 && echo 'fn main() { println!("Dummy") }' > ./src/bin/main.rs
24 RUN cargo build --release
25 RUN rm -f ./target/x86_64-unknown-linux-musl/release/deps/lemmy_server*
26 COPY server/src ./src/
27 COPY server/migrations ./migrations/
30 RUN cargo build --frozen --release
32 # Get diesel-cli on there just in case
33 # RUN cargo install diesel_cli --no-default-features --features postgres
36 FROM ekidd/rust-musl-builder:1.38.0-openssl11 as docs
39 RUN sudo chown -R rust:rust .
40 RUN mdbook build docs/
45 # Install libpq for postgres
49 COPY server/config/defaults.hjson /config/defaults.hjson
50 COPY --from=rust /app/server/target/x86_64-unknown-linux-musl/release/lemmy_server /app/lemmy
51 COPY --from=docs /app/docs/book/ /app/dist/documentation/
52 COPY --from=node /app/ui/dist /app/dist
54 RUN addgroup -g 1000 lemmy
55 RUN adduser -D -s /bin/sh -u 1000 -G lemmy lemmy
56 RUN chown lemmy:lemmy /app/lemmy