-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* upgrade dependencies and fix lint bugs * cleanup dockerfile --------- Co-authored-by: Richard Hagen <[email protected]>
- Loading branch information
Showing
7 changed files
with
185 additions
and
263 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,10 +5,6 @@ ENV GO111MODULE=on | |
RUN apk update && \ | ||
apk add bash jq alpine-sdk sed gawk git ca-certificates curl mc && \ | ||
apk add --no-cache gcc musl-dev | ||
RUN go install honnef.co/go/tools/cmd/[email protected] && \ | ||
go install github.com/rakyll/[email protected] && \ | ||
go install github.com/golang/mock/[email protected] && \ | ||
go install github.com/go-swagger/go-swagger/cmd/[email protected] | ||
|
||
WORKDIR /app | ||
|
||
|
@@ -19,17 +15,10 @@ RUN go mod download | |
# Copy project code | ||
COPY . /app | ||
|
||
# lint and unit tests | ||
RUN staticcheck ./... && \ | ||
go vet ./... && \ | ||
CGO_ENABLED=0 GOOS=linux go test ./... | ||
|
||
RUN addgroup -S -g 1000 radix && adduser -S -u 1000 -G radix radix | ||
|
||
# Build | ||
RUN swagger generate client -t ./generated-client -f https://api.radix.equinor.com/swaggerui/swagger.json -A radixapi && \ | ||
go mod tidy && \ | ||
CGO_ENABLED=0 GOOS=linux go build -ldflags "-s -w" -a -installsuffix cgo -o ./rootfs/rx | ||
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags "-s -w" -a -installsuffix cgo -o ./rootfs/rx | ||
|
||
## Run operator | ||
FROM scratch | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,8 +2,8 @@ ENVIRONMENT ?= dev | |
VERSION ?= 0.0.1 | ||
RELEASE_NOTE ?= "First release" | ||
|
||
.PHONY: generate-client | ||
generate-client: | ||
.PHONY: swagger | ||
swagger: bootstrap | ||
swagger generate client -t ./generated-client -f https://api.radix.equinor.com/swaggerui/swagger.json -A radixapi | ||
|
||
.PHONY: push | ||
|
@@ -12,5 +12,17 @@ push: | |
docker login ghcr.io/equinor | ||
docker push ghcr.io/equinor/radix/rx:latest | ||
|
||
staticcheck: | ||
staticcheck ./... | ||
.PHONY: lint | ||
lint: bootstrap | ||
golangci-lint run --max-same-issues 0 | ||
|
||
HAS_SWAGGER := $(shell command -v swagger;) | ||
HAS_GOLANGCI_LINT := $(shell command -v golangci-lint;) | ||
|
||
bootstrap: | ||
ifndef HAS_SWAGGER | ||
go install github.com/go-swagger/go-swagger/cmd/[email protected] | ||
endif | ||
ifndef HAS_GOLANGCI_LINT | ||
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.55.2 | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.