diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..19261bf --- /dev/null +++ b/.dockerignore @@ -0,0 +1,5 @@ +.git +.github +packaged +target + diff --git a/Cargo.lock b/Cargo.lock index 236c586..91ec182 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "addr2line" @@ -367,6 +367,15 @@ version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6" +[[package]] +name = "cmake" +version = "0.1.54" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7caa3f9de89ddbe2c607f4101924c5abec803763ae9534e4f4d7d8f84aa81f0" +dependencies = [ + "cc", +] + [[package]] name = "colorchoice" version = "1.0.3" @@ -1569,6 +1578,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2d16453e800a8cf6dd2fc3eb4bc99b786a9b90c663b8559a5b1a041bf89e472" dependencies = [ "cc", + "cmake", "libc", "pkg-config", "vcpkg", diff --git a/Cargo.toml b/Cargo.toml index 5253299..258aca8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -39,6 +39,7 @@ comrak = { version = "0.28.0", optional = true } default = ["reqwest/default-tls"] # link against system library rustls = ["reqwest/rustls-tls", "openidconnect/rustls-tls"] # include rustls, ssl library written in rust vendored-openssl = ["openssl/vendored"] # include compiled openssl library +vendored-zlib = ["git2/zlib-ng-compat"] # without this feature wherever the cli is installed needs to have zlib.so user-doc = [ "dep:comrak" ] [dev-dependencies] diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..24efdf4 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,9 @@ +FROM rust:bookworm AS builder +WORKDIR /app +COPY . . +RUN apt update && apt install -y cmake +RUN cargo build --release --bin rnk -F vendored-openssl -F vendored-zlib --target-dir /build + +FROM gcr.io/distroless/cc-debian12 +COPY --from=builder /build/release/rnk /rnk +ENTRYPOINT ["/rnk"] diff --git a/musl.Dockerfile b/musl.Dockerfile new file mode 100644 index 0000000..dc4ce07 --- /dev/null +++ b/musl.Dockerfile @@ -0,0 +1,9 @@ +FROM rust:bookworm AS builder +WORKDIR /app +COPY . . +RUN apt update && apt install -y cmake musl-tools +RUN rustup target add x86_64-unknown-linux-musl && cargo build --release --bin rnk -F vendored-openssl -F vendored-zlib --target-dir /build --target=x86_64-unknown-linux-musl + +FROM gcr.io/distroless/static +COPY --from=builder /build/x86_64-unknown-linux-musl/release/rnk /rnk +ENTRYPOINT ["/rnk"]