diff --git a/Cargo.lock b/Cargo.lock index 5fafa88..6f60689 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1318,30 +1318,18 @@ checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "openssl" -version = "0.10.64" +version = "0.10.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95a0481286a310808298130d22dd1fef0fa571e05a8f44ec801801e84b216b1f" +checksum = "a61075b62a23fef5a29815de7536d940aa35ce96d18ce0cc5076272db678a577" dependencies = [ - "bitflags 2.5.0", + "bitflags 1.3.2", "cfg-if", "foreign-types", "libc", "once_cell", - "openssl-macros", "openssl-sys", ] -[[package]] -name = "openssl-macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.65", -] - [[package]] name = "openssl-probe" version = "0.1.5" diff --git a/Dockerfile b/Dockerfile index 1fc6900..78eb88c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,8 +5,7 @@ RUN mkdir -p ~/.cargo && \ echo 'protocol = "sparse"' >> ~/.cargo/config RUN apk add --no-cache libc-dev -RUN apk add openssl -RUN apk add pkgconfig +RUN apk add --no-cache pkgconfig openssl-dev RUN cargo new --bin /app WORKDIR /app @@ -17,11 +16,15 @@ WORKDIR /app COPY Cargo.toml . COPY Cargo.lock . +RUN cargo update +ENV RUSTFLAGS="-Ctarget-feature=-crt-static" +ENV PKG_CONFIG_ALLOW_CROSS=1 RUN cargo build --release && rm -rf src/ # Copy the source code and run the build again. This should only compile the # app itself as the dependencies were already built above. COPY . ./ +RUN cargo update RUN rm target/release/deps/uptime_checker* && cargo build --release FROM alpine:3.20 diff --git a/src/checker.rs b/src/checker.rs index ef3abfe..e747ac0 100644 --- a/src/checker.rs +++ b/src/checker.rs @@ -33,8 +33,6 @@ pub async fn do_request( /// Makes a request to a url to determine whether it is up. /// Up is defined as returning a 2xx within a specific timeframe. pub async fn check_url(client: &reqwest::Client, url: String) -> CheckResult { - - match do_request(client, url).await { Ok(_) => CheckResult::SUCCESS, Err(e) => {