build: switch Docker images to Alpine and update to latest versions

This commit is contained in:
NetworkCats
2026-03-03 00:27:11 +08:00
parent 8eaef00eb7
commit 23bac61ed4
2 changed files with 12 additions and 7 deletions
+10 -5
View File
@@ -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
+2 -2
View File
@@ -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