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
37 # Install libpq for postgres
41 COPY --from=rust /app/server/target/x86_64-unknown-linux-musl/release/lemmy_server /app/lemmy
42 COPY --from=node /app/ui/dist /app/dist
43 RUN addgroup -g 1000 lemmy
44 RUN adduser -D -s /bin/sh -u 1000 -G lemmy lemmy
45 RUN chown lemmy:lemmy /app/lemmy