From e81722b8d2f1b4940913e838bbb96ada9fe7d3ad Mon Sep 17 00:00:00 2001 From: Jianxin <320753691@qq.com> Date: Thu, 4 Jun 2026 17:40:57 +0800 Subject: [PATCH] slim down image: python:3.10-slim base + python-based healthcheck Base python:3.10 (917MB) dominated the 986MB image and kaniko's snapshot/push time. All deps are pure-python/wheels, so slim works without build tools. Replace the curl healthcheck (curl absent in slim) with a stdlib urllib check. Co-Authored-By: Claude Opus 4.8 (1M context) --- Dockerfile | 2 +- docker-compose.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index e8f4062..10d4e62 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.10 +FROM python:3.10-slim # WORKDIR /code diff --git a/docker-compose.yaml b/docker-compose.yaml index 2163ec0..44271f1 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -22,7 +22,7 @@ services: - OFFICE_XBOT_VIEW_ID=${OFFICE_XBOT_VIEW_ID} - TZ=Asia/Shanghai healthcheck: - test: ["CMD", "curl", "-f", "http://127.0.0.1:8080/index"] + test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8080/index')"] interval: 30s timeout: 10s retries: 3