From 29afc2e92e4ca22e589cc9c8a4fda531caecd63d Mon Sep 17 00:00:00 2001 From: Gabriel Kaszewski Date: Tue, 9 Sep 2025 04:03:14 +0200 Subject: [PATCH] fix: update Dockerfiles to install necessary packages without recommendations --- thoughts-backend/Dockerfile | 2 +- thoughts-backend/api/src/routers/root.rs | 12 +++++++++--- thoughts-frontend/Dockerfile | 2 ++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/thoughts-backend/Dockerfile b/thoughts-backend/Dockerfile index cced60e..799e60d 100644 --- a/thoughts-backend/Dockerfile +++ b/thoughts-backend/Dockerfile @@ -26,7 +26,7 @@ RUN cargo build --release --bin thoughts-backend FROM debian:13-slim AS runtime -RUN apt-get update && apt-get install -y openssl && rm -rf /var/lib/apt/lists/* +RUN apt-get update && apt-get install -y --no-install-recommends openssl wget && rm -rf /var/lib/apt/lists/* RUN groupadd --system --gid 1001 appgroup && \ useradd --system --uid 1001 --gid appgroup appuser diff --git a/thoughts-backend/api/src/routers/root.rs b/thoughts-backend/api/src/routers/root.rs index 7bbde63..bd91d07 100644 --- a/thoughts-backend/api/src/routers/root.rs +++ b/thoughts-backend/api/src/routers/root.rs @@ -1,4 +1,4 @@ -use axum::{extract::State, routing::get, Router}; +use axum::{extract::State, http::StatusCode, routing::get, Router}; use sea_orm::{ConnectionTrait, Statement}; use app::state::AppState; @@ -25,6 +25,12 @@ async fn root_get(state: State) -> Result { result.unwrap().try_get_by(0).map_err(|e| e.into()) } -pub fn create_root_router() -> Router { - Router::new().route("/", get(root_get)) +async fn health_check() -> StatusCode { + StatusCode::OK +} + +pub fn create_root_router() -> Router { + Router::new() + .route("/", get(root_get)) + .route("/health", get(health_check)) } diff --git a/thoughts-frontend/Dockerfile b/thoughts-frontend/Dockerfile index 3d9ab77..4a421ea 100644 --- a/thoughts-frontend/Dockerfile +++ b/thoughts-frontend/Dockerfile @@ -17,6 +17,8 @@ RUN bun run build FROM node:22-slim AS release +RUN apt-get update && apt-get install -y --no-install-recommends netcat-openbsd && rm -rf /var/lib/apt/lists/* + COPY --from=builder /app/public ./public COPY --from=builder /app/.next/standalone ./ COPY --from=builder /app/.next/static ./.next/static