From 1a4ae07e6b5a6f4ef8986ff26924f1bee0fbc6c2 Mon Sep 17 00:00:00 2001 From: Hamcha Date: Sat, 25 Nov 2023 14:42:36 +0100 Subject: [PATCH] minor changes --- .cargo/config.toml | 3 +++ Cargo.lock | 12 ------------ Cargo.toml | 1 - Dockerfile | 5 ++++- src/main.rs | 13 +++++++------ 5 files changed, 14 insertions(+), 20 deletions(-) create mode 100644 .cargo/config.toml diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 0000000..5909338 --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,3 @@ +[target.x86_64-unknown-linux-gnu] +linker = "clang" +rustflags = ["-Clink-arg=-fuse-ld=mold"] diff --git a/Cargo.lock b/Cargo.lock index c6123fd..fb673bb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1317,7 +1317,6 @@ dependencies = [ "thiserror", "time", "tokio", - "tokio-stream", "tracing", "tracing-subscriber", ] @@ -1483,17 +1482,6 @@ dependencies = [ "syn", ] -[[package]] -name = "tokio-stream" -version = "0.1.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "397c988d37662c7dda6d2208364a706264bf3d6138b11d436cbac0ad38832842" -dependencies = [ - "futures-core", - "pin-project-lite", - "tokio", -] - [[package]] name = "tokio-util" version = "0.7.10" diff --git a/Cargo.toml b/Cargo.toml index 5c07c03..dab934a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,6 +23,5 @@ tempfile = "3" thiserror = "1" time = { version = "0.3", features = ["serde"] } tokio = { version = "1", features = ["full"] } -tokio-stream = "0.1" tracing = "0.1" tracing-subscriber = "0.3" diff --git a/Dockerfile b/Dockerfile index c0f751c..c32b27c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,16 @@ FROM public.ecr.aws/docker/library/rust:1-alpine as builder RUN rustup default stable -RUN apk add --no-cache musl-dev openssl-dev openssl-libs-static pkgconf git +RUN apk add --no-cache musl-dev openssl-dev openssl-libs-static pkgconf git mold clang # Set `SYSROOT` to a dummy path (default is /usr) because pkg-config-rs *always* # links those located in that path dynamically but we want static linking, c.f. # https://github.com/rust-lang/pkg-config-rs/blob/54325785816695df031cef3b26b6a9a203bbc01b/src/lib.rs#L613 ENV SYSROOT=/dummy +# Compilation speedup +ENV CARGO_INCREMENTAL=0 + WORKDIR /wd COPY . /wd RUN cargo build --release --target=x86_64-unknown-linux-musl diff --git a/src/main.rs b/src/main.rs index 8061581..e164893 100644 --- a/src/main.rs +++ b/src/main.rs @@ -54,16 +54,17 @@ async fn main() -> Result<()> { _ = dotenvy::dotenv(); tracing_subscriber::fmt::init(); - // Try to connect to docker server - let docker = Docker::connect_with_local_defaults()?; - // Ping to make sure it works - let version = docker.version().await?; - tracing::info!("docker version: {}", version.version.unwrap()); - // Parse args let args = Args::parse(); tracing::info!("listening on {}", &args.bind); + // Try to connect to docker server + let docker = Docker::connect_with_local_defaults()?; + + // Ping to make sure it works + let version = docker.version().await?; + tracing::info!("docker version: {}", version.version.unwrap()); + let (author_name, author_email) = parse_author(&args.git_author)?; let gitconfig = GitConfig { author_name,