Skip to content

Commit

Permalink
feat: update docker image to bookworm-slim and remove openssl as a de…
Browse files Browse the repository at this point in the history
…pendency, use rustls instead
  • Loading branch information
koskeller committed Dec 15, 2023
1 parent 060ca73 commit 654accc
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 143 deletions.
136 changes: 1 addition & 135 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ hyper = "0.14.27"
tower-http = { version = "0.4.1", features = ["trace", "timeout", "sensitive-headers", "request-id", "cors"] }
tower = { version = "0.4.13", features = []}
axum = "0.6.18"
sqlx = { version = "0.7.0", features = ["postgres", "runtime-tokio-rustls", "macros", "migrate", "chrono", "uuid"] }
sqlx = { version = "0.7.0", features = ["postgres", "runtime-tokio-rustls", "macros", "migrate", "chrono", "json", "uuid"] }

tracing = "0.1.37"
tracing-subscriber = { version = "0.3.17", features = ["json", "env-filter"] }

reqwest = { version = "0.11.18", features = ["json", "rustls-tls"] }
reqwest = { version = "0.11.18", default-features = false, features = ["json", "rustls-tls"] }
chrono = { version = "0.4.26", features = ["serde"] }
serde = { version = "1.0.171", features = ["derive"] }
serde_json = "1.0.102"
uuid = { version = "1.4.0", features = ["v4"] }
uuid = { version = "1.4.0", features = ["v4", "serde"] }

dotenv = "0.15.0"
thiserror = "1.0.43"
Expand Down
21 changes: 17 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM lukemathwalker/cargo-chef:latest-rust-latest as chef
FROM lukemathwalker/cargo-chef:0.1.62-rust-bookworm as chef
WORKDIR /app
RUN apt update && apt install lld clang -y

Expand All @@ -16,16 +16,29 @@ COPY . .
# Build project
RUN cargo build --release --bin server

FROM debian:bullseye-slim AS runtime
FROM debian:bookworm-slim AS runtime

# Set the working directory
WORKDIR /app

# Install runtime dependencies
RUN apt-get update -y \
&& apt-get install -y --no-install-recommends openssl ca-certificates \
# Clean up
&& apt-get install -y --no-install-recommends ca-certificates \
# Clean up to keep the image size small
&& apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*

# Copy the compiled binary from the builder stage
COPY --from=builder /app/target/release/server server

# Set environment variables
ENV PORT 8080
ENV APP_ENVIRONMENT production
ENV RUST_LOG server=info,tower_http=info,sqlx=info

# Expose the port your app runs on
EXPOSE 8080

# Run the binary
ENTRYPOINT ["./server"]
2 changes: 1 addition & 1 deletion tests/api/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ impl TestApp {
// Set port to 0 so tests can spawn multiple servers on OS assigned ports.
std::env::set_var("PORT", "0");

// The default timeout value is set to 15 seconds. Once.
// Setup tracing. Once.
TRACING.call_once(setup_tracing);

// Parse configuration from the environment.
Expand Down

0 comments on commit 654accc

Please sign in to comment.