feat: initial commit
This commit is contained in:
+37
@@ -0,0 +1,37 @@
|
||||
FROM golang:1.15 as build
|
||||
ARG CODECOV_ENV
|
||||
ARG CODECOV_TOKEN
|
||||
ARG CODECOV_URL
|
||||
ARG CODECOV_SLUG
|
||||
ARG VCS_COMMIT_ID
|
||||
ARG VCS_BRANCH_NAME
|
||||
ARG VCS_PULL_REQUEST
|
||||
ARG VCS_SLUG
|
||||
ARG VCS_TAG
|
||||
ARG CI_BUILD_URL
|
||||
ARG CI_BUILD_ID
|
||||
ARG CI_JOB_ID
|
||||
ARG GITLAB_CI
|
||||
ARG CI_BUILD_REF_NAME
|
||||
ARG CI_BUILD_ID
|
||||
ARG CI_BUILD_REPO
|
||||
ARG CI_BUILD_REF
|
||||
WORKDIR /build
|
||||
ENV CGO_ENABLED=0
|
||||
ADD . /build
|
||||
RUN if [ $(go mod tidy -v 2>&1 | grep -c unused) != 0 ]; then echo "Unused modules, please run 'go mod tidy'"; exit 1; fi
|
||||
RUN go fmt ./...
|
||||
RUN go vet ./...
|
||||
RUN CGO_ENABLED=1 go test -mod=readonly -race -coverprofile=coverage.txt.tmp -covermode=atomic -coverpkg=$(go list ./... | tr '\n' , | sed 's/,$//') ./...
|
||||
RUN ["/bin/bash", "-c", "cat coverage.txt.tmp | grep -v -f <(find . -type f | xargs grep -l 'Code generated') > coverage.txt"]
|
||||
RUN go tool cover -html=coverage.txt -o coverage.html
|
||||
RUN go tool cover -func=coverage.txt
|
||||
RUN rm coverage.txt.tmp
|
||||
RUN curl -s https://codecov.io/bash | bash
|
||||
|
||||
RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -mod=readonly -o release/cron-checker -ldflags '-w -s'
|
||||
|
||||
FROM scratch
|
||||
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
|
||||
COPY --from=build /build/release/cron-checker /
|
||||
CMD ["/cron-checker"]
|
||||
Reference in New Issue
Block a user