diff --git a/CHANGELOG.md b/CHANGELOG.md index 75975c4..4440815 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.1.1] - 2023-12-04 +- Updated dependencies +- Updated Dockerfile + ## [0.1.0] - 2023-06-25 - Added Tracing package for logging - Updated dependencies diff --git a/Cargo.lock b/Cargo.lock index c23933c..3247870 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -114,12 +114,11 @@ dependencies = [ "axum", "chrono", "clap", - "hyper 0.14.27", + "hyper", "pretty_assertions", "serde", "serde_json", "sqlx", - "thiserror", "tokio", "tower", "tower-http", @@ -165,10 +164,10 @@ dependencies = [ "axum-core", "bytes", "futures-util", - "http 1.0.0", - "http-body 1.0.0", + "http", + "http-body", "http-body-util", - "hyper 1.0.1", + "hyper", "hyper-util", "itoa", "matchit", @@ -197,8 +196,8 @@ dependencies = [ "async-trait", "bytes", "futures-util", - "http 1.0.0", - "http-body 1.0.0", + "http", + "http-body", "http-body-util", "mime", "pin-project-lite", @@ -637,25 +636,6 @@ version = "0.27.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" -[[package]] -name = "h2" -version = "0.3.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97ec8491ebaf99c8eaa73058b045fe58073cd6be7f596ac993ced0b0a0c01049" -dependencies = [ - "bytes", - "fnv", - "futures-core", - "futures-sink", - "futures-util", - "http 0.2.9", - "indexmap 1.9.3", - "slab", - "tokio", - "tokio-util", - "tracing", -] - [[package]] name = "h2" version = "0.4.0" @@ -667,20 +647,14 @@ dependencies = [ "futures-core", "futures-sink", "futures-util", - "http 1.0.0", - "indexmap 2.0.0", + "http", + "indexmap", "slab", "tokio", "tokio-util", "tracing", ] -[[package]] -name = "hashbrown" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" - [[package]] name = "hashbrown" version = "0.14.0" @@ -697,7 +671,7 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "312f66718a2d7789ffef4f4b7b213138ed9f1eb3aa1d0d82fc99f88fb3ffd26f" dependencies = [ - "hashbrown 0.14.0", + "hashbrown", ] [[package]] @@ -748,17 +722,6 @@ dependencies = [ "windows-sys", ] -[[package]] -name = "http" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" -dependencies = [ - "bytes", - "fnv", - "itoa", -] - [[package]] name = "http" version = "1.0.0" @@ -770,17 +733,6 @@ dependencies = [ "itoa", ] -[[package]] -name = "http-body" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" -dependencies = [ - "bytes", - "http 0.2.9", - "pin-project-lite", -] - [[package]] name = "http-body" version = "1.0.0" @@ -788,7 +740,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643" dependencies = [ "bytes", - "http 1.0.0", + "http", ] [[package]] @@ -799,8 +751,8 @@ checksum = "41cb79eb393015dadd30fc252023adb0b2400a0caee0fa2a077e6e21a551e840" dependencies = [ "bytes", "futures-util", - "http 1.0.0", - "http-body 1.0.0", + "http", + "http-body", "pin-project-lite", ] @@ -816,30 +768,6 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" -[[package]] -name = "hyper" -version = "0.14.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" -dependencies = [ - "bytes", - "futures-channel", - "futures-core", - "futures-util", - "h2 0.3.20", - "http 0.2.9", - "http-body 0.4.5", - "httparse", - "httpdate", - "itoa", - "pin-project-lite", - "socket2 0.4.9", - "tokio", - "tower-service", - "tracing", - "want", -] - [[package]] name = "hyper" version = "1.0.1" @@ -849,14 +777,15 @@ dependencies = [ "bytes", "futures-channel", "futures-util", - "h2 0.4.0", - "http 1.0.0", - "http-body 1.0.0", + "h2", + "http", + "http-body", "httparse", "httpdate", "itoa", "pin-project-lite", "tokio", + "want", ] [[package]] @@ -868,11 +797,11 @@ dependencies = [ "bytes", "futures-channel", "futures-util", - "http 1.0.0", - "http-body 1.0.0", - "hyper 1.0.1", + "http", + "http-body", + "hyper", "pin-project-lite", - "socket2 0.5.3", + "socket2", "tokio", "tower", "tower-service", @@ -918,16 +847,6 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb56e1aa765b4b4f3aadfab769793b7087bb03a4ea4920644a6d238e2df5b9ed" -[[package]] -name = "indexmap" -version = "1.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" -dependencies = [ - "autocfg", - "hashbrown 0.12.3", -] - [[package]] name = "indexmap" version = "2.0.0" @@ -935,7 +854,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d" dependencies = [ "equivalent", - "hashbrown 0.14.0", + "hashbrown", ] [[package]] @@ -973,9 +892,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.147" +version = "0.2.150" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" +checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" [[package]] name = "libm" @@ -1060,9 +979,9 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.8" +version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" +checksum = "3dce281c5e46beae905d4de1870d8b1509a9142b62eedf18b443b011ca8343d0" dependencies = [ "libc", "wasi", @@ -1631,19 +1550,9 @@ checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" [[package]] name = "socket2" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" -dependencies = [ - "libc", - "winapi", -] - -[[package]] -name = "socket2" -version = "0.5.3" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2538b18701741680e0322a2302176d3253a35388e2e62f172f64f4f16605f877" +checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" dependencies = [ "libc", "windows-sys", @@ -1721,7 +1630,7 @@ dependencies = [ "futures-util", "hashlink", "hex", - "indexmap 2.0.0", + "indexmap", "log", "memchr", "once_cell", @@ -2001,9 +1910,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.33.0" +version = "1.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f38200e3ef7995e5ef13baec2f432a6da0aa9ac495b2c0e8f3b7eec2c92d653" +checksum = "d0c014766411e834f7af5b8f4cf46257aab4036ca95e9d2c144a10f59ad6f5b9" dependencies = [ "backtrace", "bytes", @@ -2013,16 +1922,16 @@ dependencies = [ "parking_lot", "pin-project-lite", "signal-hook-registry", - "socket2 0.5.3", + "socket2", "tokio-macros", "windows-sys", ] [[package]] name = "tokio-macros" -version = "2.1.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" +checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", @@ -2079,8 +1988,8 @@ dependencies = [ "bitflags 2.3.3", "bytes", "futures-util", - "http 1.0.0", - "http-body 1.0.0", + "http", + "http-body", "http-body-util", "pin-project-lite", "tower-layer", @@ -2228,9 +2137,9 @@ checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" [[package]] name = "uuid" -version = "1.4.1" +version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79daa5ed5740825c40b389c5e50312b9c86df53fccd33f281df655642b43869d" +checksum = "5e395fcf16a7a3d8127ec99782007af141946b4795001f876d54fb0d55978560" dependencies = [ "getrandom", "serde", diff --git a/Cargo.toml b/Cargo.toml index 7e1434f..4d2c847 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ members = ["xtask"] [package] name = "api" description = "A cleanly designed Rust REST Api" -version = "0.1.0" +version = "0.2.0" edition = "2021" authors = ["Tristan J. Schoenmakers "] repository = "https://github.com/TristanJSchoenmakers/clean-architecture" @@ -13,21 +13,19 @@ repository = "https://github.com/TristanJSchoenmakers/clean-architecture" [dependencies] axum = "0.7" -chrono = { version = "0.4.31", features = ["serde"] } -clap = { version = "4.4.6", features = ["derive", "env"] } -serde = { version = "1.0.189", features = ["derive"] } -serde_json = "1.0.107" -sqlx = { version = "0.7.2", features = ["runtime-tokio-rustls", "postgres", "chrono", "uuid"] } -thiserror = "1.0.49" -tokio = { version = "1.33.0", features = ["full"] } -tower = "0.4" +chrono = { version = "0.4", features = ["serde"] } +clap = { version = "4.4", features = ["derive", "env"] } +serde = { version = "1.0", features = ["derive"] } +serde_json = "1.0" +sqlx = { version = "0.7", features = ["runtime-tokio-rustls", "postgres", "chrono", "uuid"] } +tokio = { version = "1.34", features = ["full"] } +tower = { version = "0.4", features = ["util"] } tower-http = { version = "0.5", features = ["trace"] } -tracing = "0.1.39" -tracing-subscriber = "0.3.17" -uuid = { version = "1.4.1", features = [ "v4", "serde" ] } -validator = { version = "0.16.1", features = ["derive"] } +tracing = "0.1" +tracing-subscriber = "0.3" +uuid = { version = "1.6", features = [ "v4", "serde" ] } +validator = { version = "0.16", features = ["derive"] } [dev-dependencies] -hyper = { version = "0.14.27", features = ["full"] } -pretty_assertions = "1.4.0" -tower = { version = "0.4.13", features = ["util"] } +hyper = { version = "1.0", features = ["full"] } +pretty_assertions = "1.4" diff --git a/Dockerfile b/Dockerfile index 909fb63..cd96752 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,25 +1,22 @@ FROM messense/rust-musl-cross:x86_64-musl as chef ENV SQLX_OFFLINE=true RUN cargo install cargo-chef -WORKDIR /api-deployment-example +WORKDIR /app FROM chef AS planner -# Copy source code from previous stage COPY . . -# Generate info for caching dependencies RUN cargo chef prepare --recipe-path recipe.json FROM chef AS builder -COPY --from=planner /api-deployment-example/recipe.json recipe.json +COPY --from=planner /app/recipe.json recipe.json # Build & cache dependencies RUN cargo chef cook --release --target x86_64-unknown-linux-musl --recipe-path recipe.json -# Copy source code from previous stage -COPY . . # Build application +COPY . . RUN cargo build --release --target x86_64-unknown-linux-musl # Create a new stage with a minimal image FROM scratch -COPY --from=builder /api-deployment-example/target/x86_64-unknown-linux-musl/release/api /api +COPY --from=builder /app/target/x86_64-unknown-linux-musl/release/api /api ENTRYPOINT ["/api"] -EXPOSE 8000 \ No newline at end of file +EXPOSE 8000