51 lines
983 B
Plaintext
51 lines
983 B
Plaintext
|
VERSION 0.6
|
||
|
FROM golang:1.19.4-alpine3.16
|
||
|
WORKDIR /code
|
||
|
|
||
|
ci:
|
||
|
BUILD +lint
|
||
|
BUILD +lint-test
|
||
|
|
||
|
deps:
|
||
|
RUN apk add --no-cache \
|
||
|
build-base \
|
||
|
protoc
|
||
|
RUN (cd /tmp; go install github.com/bufbuild/buf/cmd/buf@v1.10.0)
|
||
|
RUN (cd /tmp; go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28.1)
|
||
|
RUN (cd /tmp; go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.50.1)
|
||
|
|
||
|
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
|