From: Dessalines Date: Fri, 12 Jun 2020 20:17:01 +0000 (-0400) Subject: Adding lld to docker builds. #810 X-Git-Url: http://these/git/%22https:/image.com/readmes/%7B%60%24%7BarchiveUrl%7D/static/%24%7Bargs.pageFn.next%7D?a=commitdiff_plain;h=7cb7c1f0f9a77c3019200edffa5381f8a4d76e55;p=lemmy.git Adding lld to docker builds. #810 --- diff --git a/docker/dev/Dockerfile b/docker/dev/Dockerfile index fbec2536..3ebfa097 100644 --- a/docker/dev/Dockerfile +++ b/docker/dev/Dockerfile @@ -12,6 +12,10 @@ RUN yarn build FROM ekidd/rust-musl-builder:1.42.0-openssl11 as rust +# Install lld +RUN sudo apt-get update -y +RUN sudo apt-get install -y lld + # Cache deps WORKDIR /app RUN sudo chown -R rust:rust . @@ -21,13 +25,13 @@ COPY server/Cargo.toml server/Cargo.lock ./ RUN sudo chown -R rust:rust . RUN mkdir -p ./src/bin \ && echo 'fn main() { println!("Dummy") }' > ./src/bin/main.rs -RUN cargo build +RUN RUSTFLAGS="-Clink-arg=-fuse-ld=lld" cargo build RUN rm -f ./target/x86_64-unknown-linux-musl/release/deps/lemmy_server* COPY server/src ./src/ COPY server/migrations ./migrations/ # Build for debug -RUN cargo build +RUN RUSTFLAGS="-Clink-arg=-fuse-ld=lld" cargo build FROM ekidd/rust-musl-builder:1.42.0-openssl11 as docs WORKDIR /app diff --git a/docker/prod/Dockerfile b/docker/prod/Dockerfile index b9eec456..bc17a186 100644 --- a/docker/prod/Dockerfile +++ b/docker/prod/Dockerfile @@ -12,6 +12,10 @@ RUN yarn build FROM ekidd/rust-musl-builder:1.42.0-openssl11 as rust +# Install lld +RUN sudo apt-get update -y +RUN sudo apt-get install -y lld + # Cache deps WORKDIR /app RUN sudo chown -R rust:rust . @@ -21,13 +25,13 @@ COPY server/Cargo.toml server/Cargo.lock ./ RUN sudo chown -R rust:rust . RUN mkdir -p ./src/bin \ && echo 'fn main() { println!("Dummy") }' > ./src/bin/main.rs -RUN cargo build --release +RUN RUSTFLAGS="-Clink-arg=-fuse-ld=lld" cargo build --release RUN rm -f ./target/x86_64-unknown-linux-musl/release/deps/lemmy_server* COPY server/src ./src/ COPY server/migrations ./migrations/ # Build for release -RUN cargo build --frozen --release +RUN RUSTFLAGS="-Clink-arg=-fuse-ld=lld" cargo build --frozen --release # reduce binary size RUN strip /app/server/target/x86_64-unknown-linux-musl/release/lemmy_server