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