VERSION 0.6 ARG BUF_VERSION=1.10.0 ARG GOLANGCILINT_VERSION=1.50.1 ARG GO_VERSION=1.19.4 ARG PROTOGENGO_VERSION=1.28.1 FROM golang:$GO_VERSION-alpine3.16 WORKDIR /code ci: BUILD +lint BUILD +lint-test deps: RUN apk add --no-cache \ build-base \ git \ protoc RUN (cd /tmp; go install github.com/bufbuild/buf/cmd/buf@v$BUF_VERSION) RUN (cd /tmp; go install google.golang.org/protobuf/cmd/protoc-gen-go@v$PROTOGENGO_VERSION) RUN (cd /tmp; go install github.com/golangci/golangci-lint/cmd/golangci-lint@v$GOLANGCILINT_VERSION) build: FROM +deps COPY go.mod go.sum ./ COPY --dir vendor ./ COPY main.go ./ RUN go install . code: COPY go.mod go.sum ./ COPY --dir vendor ./ COPY main.go ./ SAVE ARTIFACT . files lint: FROM +deps COPY +code/files ./ RUN golangci-lint run main.go lint-test: FROM +deps COPY +generate/generated go RUN go mod init git.wobcom.de/smartmetering/foo RUN go mod tidy RUN golangci-lint run generate: FROM +build COPY --dir test ./ WORKDIR test RUN buf ls-files RUN buf lint -v RUN buf generate -v # RUN --no-cache cat go/foo/v1/foo.value_scan.pb.go SAVE ARTIFACT go generated