From 280571e42af1f6a593c9583a0216c980cc996b74 Mon Sep 17 00:00:00 2001 From: YANGJINZE Date: Wed, 14 Jan 2026 17:45:54 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E8=B0=83=E6=95=B4=E3=80=91=E4=BC=98?= =?UTF-8?q?=E5=8C=96Dockerfile=EF=BC=8C=E4=BD=BF=E7=94=A8=E6=9E=84?= =?UTF-8?q?=E5=BB=BA=E9=98=B6=E6=AE=B5=E6=9E=84=E5=BB=BA=E5=BA=94=E7=94=A8?= =?UTF-8?q?=E7=A8=8B=E5=BA=8F=EF=BC=8C=E7=AE=80=E5=8C=96=E8=BF=90=E8=A1=8C?= =?UTF-8?q?=E6=97=B6=E4=BE=9D=E8=B5=96=E5=AE=89=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index bdad71e..4985d00 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,32 @@ +# Build stage +FROM golang:1.24-alpine AS builder + +WORKDIR /build + +# Install build dependencies +RUN apk add --no-cache git make gcc musl-dev + +# Copy go mod files +COPY go.mod go.sum ./ +RUN go mod download + +# Copy source code +COPY . . + +# Build the application +RUN CGO_ENABLED=1 GOOS=linux go build -ldflags="-s -w" -o allinssl ./cmd/main.go + +# Final stage FROM frolvlad/alpine-glibc WORKDIR /www/allinssl/ -RUN apk add --no-cache curl tzdata\ - && curl https://node1.allinssl.com/bin/allinssl-$(uname -s)-$(uname -m).tar.gz | tar -xz -C /www/allinssl/ \ - && apk del curl +# Install runtime dependencies +RUN apk add --no-cache tzdata + +# Copy binary from builder +COPY --from=builder /build/allinssl /www/allinssl/allinssl + ENV TZ=Asia/Shanghai RUN cat > /entrypoint.sh <<'EOF' #!/bin/sh