mirror of https://github.com/LemmyNet/lemmy.git
Adding lld to docker builds. #810
parent
da6de03536
commit
7cb7c1f0f9
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue