From 23bac61ed4d460978adb0329b9a0c0b0c867f13e Mon Sep 17 00:00:00 2001 From: NetworkCats Date: Tue, 3 Mar 2026 00:27:11 +0800 Subject: [PATCH] build: switch Docker images to Alpine and update to latest versions --- Dockerfile | 15 ++++++++++----- docker-compose.yml | 4 ++-- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 75102f0..d53adff 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,7 @@ -FROM rust:1.92-slim AS builder +# Build Stage +FROM rust:1.93.1-alpine3.23 AS builder + +RUN apk add --no-cache musl-dev WORKDIR /build COPY Cargo.toml Cargo.lock ./ @@ -8,17 +11,19 @@ COPY static ./static RUN cargo build --release -FROM debian:bookworm-slim +# Runtime Stage +FROM alpine:3.23.3 -RUN apt-get update && apt-get install -y --no-install-recommends curl ca-certificates \ - && rm -rf /var/lib/apt/lists/* \ - && groupadd -r rustyip && useradd -r -g rustyip rustyip +RUN apk add --no-cache ca-certificates \ + && addgroup -S -g 1001 rustyip \ + && adduser -S -u 1001 -G rustyip rustyip COPY --from=builder /build/target/release/rustyip /usr/local/bin/rustyip COPY --from=builder /build/templates /app/templates COPY --from=builder /build/static /app/static WORKDIR /app +RUN chown -R rustyip:rustyip /app USER rustyip diff --git a/docker-compose.yml b/docker-compose.yml index 345db60..bc06b8f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,6 @@ services: haproxy: - image: haproxy:3.3.4 + image: haproxy:3.3.4-alpine3.23 ports: - "443:443" volumes: @@ -24,7 +24,7 @@ services: volumes: - db_data:/data healthcheck: - test: ["CMD-SHELL", "curl -sf http://127.0.0.1:3000/health || exit 1"] + test: ["CMD-SHELL", "wget -qO- http://127.0.0.1:3000/health || exit 1"] interval: 10s timeout: 5s retries: 3