-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Pavel Abramov <[email protected]>
- Loading branch information
1 parent
37d889a
commit 8d7351f
Showing
4 changed files
with
91 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
ARG RUST_VERSION=1.80.1 | ||
|
||
FROM rust:${RUST_VERSION}-alpine3.20 AS toolchain | ||
ENV CARGO_BUILD_TARGET="x86_64-unknown-linux-musl" | ||
RUN rustup target add ${CARGO_BUILD_TARGET} | ||
RUN apk add --no-cache musl-dev linux-headers make clang mold | ||
RUN cargo install [email protected] | ||
|
||
FROM toolchain AS planer | ||
WORKDIR /app | ||
COPY ./Cargo.toml ./Cargo.lock ./ | ||
COPY ./benches ./benches | ||
RUN cargo chef prepare --recipe-path recipe.json | ||
|
||
FROM toolchain AS cacher | ||
WORKDIR /app | ||
COPY --from=planer /app/recipe.json recipe.json | ||
RUN cargo chef cook --release --recipe-path recipe.json | ||
|
||
FROM toolchain AS builder | ||
WORKDIR /app | ||
COPY --from=cacher /app /app | ||
COPY . /app | ||
RUN echo "Cargo target: $CARGO_BUILD_TARGET" | ||
RUN cargo build --release --target $CARGO_BUILD_TARGET | ||
|
||
FROM scratch | ||
WORKDIR /app | ||
COPY --from=builder /tmp /tmp | ||
COPY --from=builder /app/target/x86_64-unknown-linux-musl/release/nkv-server . | ||
COPY --from=builder /app/target/x86_64-unknown-linux-musl/release/nkv-client . | ||
ENTRYPOINT [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
[target.aarch64-unknown-linux-musl] | ||
linker = "/usr/bin/clang" | ||
rustflags = [ | ||
"-C", | ||
"link-arg=--ld-path=/usr/bin/mold", | ||
"-C", | ||
"link-arg=--target=aarch64-unknown-linux-musl", | ||
] | ||
|
||
[target.x86_64-unknown-linux-musl] | ||
linker = "/usr/bin/clang" | ||
rustflags = [ | ||
"-C", | ||
"link-arg=--ld-path=/usr/bin/mold", | ||
"-C", | ||
"link-arg=--target=x86_64-unknown-linux-musl", | ||
] | ||
|
||
# FIXME: riscv64 is not yet available in rust:1.80.1-alpine3.20 | ||
# but both clang and mold support it. Alos musl-dev is available in Alpine 3.20 | ||
# [target.riscv64gc-unknown-linux-gnu] | ||
# linker = "/usr/bin/clang" | ||
# rustflags = [ | ||
# "-C", | ||
# "link-arg=--ld-path=/usr/bin/mold", | ||
# "-C", | ||
# "link-arg=--target=riscv64-unknown-linux-musl", | ||
# ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters