chore(build): migrate from Alpine to Debian and update build dependencies

- Updated `Dockerfile` base images from `golang:1.26-alpine` and `alpine:3.23` to `golang:1.26-bookworm` and `debian:bookworm`.
- Replaced `apk` with `apt-get` for dependency installation.
- Added `buildvcs=false` flag to Go build command for enhanced reproducibility.
This commit is contained in:
Luis Pater
2026-06-08 11:03:46 +08:00
parent 365415c87a
commit d9a0c9bdc7

View File

@@ -1,8 +1,8 @@
FROM golang:1.26-alpine AS builder
FROM golang:1.26-bookworm AS builder
WORKDIR /app
RUN apk add --no-cache build-base
RUN apt-get update && apt-get install -y --no-install-recommends build-essential git && rm -rf /var/lib/apt/lists/*
COPY go.mod go.sum ./
@@ -14,11 +14,11 @@ ARG VERSION=dev
ARG COMMIT=none
ARG BUILD_DATE=unknown
RUN CGO_ENABLED=1 GOOS=linux go build -ldflags="-s -w -X 'main.Version=${VERSION}' -X 'main.Commit=${COMMIT}' -X 'main.BuildDate=${BUILD_DATE}'" -o ./CLIProxyAPI ./cmd/server/
RUN CGO_ENABLED=1 GOOS=linux go build -buildvcs=false -ldflags="-s -w -X 'main.Version=${VERSION}' -X 'main.Commit=${COMMIT}' -X 'main.BuildDate=${BUILD_DATE}'" -o ./CLIProxyAPI ./cmd/server/
FROM alpine:3.23
FROM debian:bookworm
RUN apk add --no-cache tzdata
RUN apt-get update && apt-get install -y --no-install-recommends tzdata && rm -rf /var/lib/apt/lists/*
RUN mkdir /CLIProxyAPI