diff --git a/stash/Dockerfile b/stash/Dockerfile.amd64 similarity index 62% rename from stash/Dockerfile rename to stash/Dockerfile.amd64 index ff78e5d..20a6bfc 100644 --- a/stash/Dockerfile +++ b/stash/Dockerfile.amd64 @@ -6,7 +6,9 @@ ENV CGO_ENABLED 0 ENV GOOS linux ENV GOPROXY https://goproxy.cn,direct -WORKDIR /build/zero +RUN apk update --no-cache && apk add --no-cache tzdata + +WORKDIR /build ADD go.mod . ADD go.sum . @@ -14,12 +16,12 @@ RUN go mod download COPY . . COPY stash/etc /app/etc RUN GOARCH=amd64 go build -ldflags="-s -w" -o /app/stash stash/stash.go -RUN apk update --no-cache && apk add upx && upx /app/stash -FROM alpine +FROM scratch -RUN apk update --no-cache && apk add --no-cache ca-certificates tzdata +COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt +COPY --from=builder /usr/share/zoneinfo/Asia/Shanghai /usr/share/zoneinfo/Asia/Shanghai ENV TZ Asia/Shanghai WORKDIR /app diff --git a/stash/Dockerfile.arm64 b/stash/Dockerfile.arm64 index 49a1777..e3edbf7 100644 --- a/stash/Dockerfile.arm64 +++ b/stash/Dockerfile.arm64 @@ -1,4 +1,4 @@ -FROM arm64v8/golang:alpine AS builder +FROM golang:alpine AS builder LABEL stage=gobuilder @@ -6,7 +6,9 @@ ENV CGO_ENABLED 0 ENV GOOS linux ENV GOPROXY https://goproxy.cn,direct -WORKDIR /build/zero +RUN apk update --no-cache && apk add --no-cache tzdata + +WORKDIR /build ADD go.mod . ADD go.sum . @@ -16,9 +18,10 @@ COPY stash/etc /app/etc RUN GOARCH=arm64 go build -ldflags="-s -w" -o /app/stash stash/stash.go -FROM arm64v8/alpine +FROM scratch -RUN apk update --no-cache && apk add --no-cache ca-certificates tzdata +COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt +COPY --from=builder /usr/share/zoneinfo/Asia/Shanghai /usr/share/zoneinfo/Asia/Shanghai ENV TZ Asia/Shanghai WORKDIR /app