1 FROM node:12-buster as node
6 COPY ui/package.json ui/yarn.lock ./
7 RUN yarn install --pure-lockfile --network-timeout 100000
14 FROM rust:1.37 as rust
18 RUN USER=root cargo new server
20 COPY server/Cargo.toml server/Cargo.lock ./
21 RUN mkdir -p ./src/bin \
22 && echo 'fn main() { println!("Dummy") }' > ./src/bin/main.rs
25 RUN rm -f ./target/debug/deps/lemmy_server*
26 COPY server/src ./src/
27 COPY server/migrations ./migrations/
30 #RUN cargo build --frozen --release
31 RUN cargo build --frozen
33 # Get diesel-cli on there just in case
34 # RUN cargo install diesel_cli --no-default-features --features postgres
36 # make result place always the same for lemmy container
37 RUN cp /app/server/target/debug/lemmy_server /app/server/ready
41 # debian because build with dynamic linking with debian:buster
42 FROM debian:buster as lemmy
44 # Install libpq for postgres
46 RUN apt-get update && apt-get install -y libpq5
49 #COPY --from=rust /app/server/target/$TARGET/debug/lemmy_server /app/lemmy
50 COPY --from=rust /app/server/ready /app/lemmy
51 COPY --from=node /app/ui/dist /app/dist
52 RUN addgroup --gid 1000 lemmy
54 #RUN adduser -D -s /bin/sh -u 1000 -G lemmy lemmy
56 RUN adduser --disabled-password --shell /bin/sh --uid 1000 --ingroup lemmy lemmy
57 RUN chown lemmy:lemmy /app/lemmy