diff --git a/README.md b/README.md index 22a21b4..251ed57 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,7 @@ go install mvdan.cc/gofumpt@v0.4.0 go install honnef.co/go/tools/cmd/staticcheck@v0.4.2 go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.60.3 go install go.uber.org/nilaway/cmd/nilaway@v0.0.0-20240821220108-c91e71c080b7 +go install github.com/daixiang0/gci@v0.11.2 ``` **Lint, test, format** diff --git a/cli.dockerfile b/cli.dockerfile index c2988c3..3b00190 100644 --- a/cli.dockerfile +++ b/cli.dockerfile @@ -1,7 +1,10 @@ # syntax=docker/dockerfile:1 -FROM golang:1.21 as builder +FROM golang:1.21 AS builder ARG VERSION WORKDIR /build +ADD go.mod /build/ +RUN --mount=type=cache,target=/root/.cache/go-build CGO_ENABLED=0 GOOS=linux \ + go mod download ADD . /build/ RUN --mount=type=cache,target=/root/.cache/go-build CGO_ENABLED=0 GOOS=linux \ go build \ diff --git a/httpserver.dockerfile b/httpserver.dockerfile index ec36b18..0fed6bb 100644 --- a/httpserver.dockerfile +++ b/httpserver.dockerfile @@ -1,7 +1,10 @@ # syntax=docker/dockerfile:1 -FROM golang:1.21 as builder +FROM golang:1.21 AS builder ARG VERSION WORKDIR /build +ADD go.mod /build/ +RUN --mount=type=cache,target=/root/.cache/go-build CGO_ENABLED=0 GOOS=linux \ + go mod download ADD . /build/ RUN --mount=type=cache,target=/root/.cache/go-build CGO_ENABLED=0 GOOS=linux \ go build \