mirror of
https://github.com/securego/gosec.git
synced 2024-11-05 19:45:51 +00:00
5f98926a7b
* ignore the temporary image file used for builds Signed-off-by: Andrew Hsu <andrewhsu@docker.com> * no need for GOPATH in the Dockerfile It is already set in the golang:1.10.3-alpine3.8 image. Signed-off-by: Andrew Hsu <andrewhsu@docker.com> * no need for GOROOT in Dockerfile The correct value is embedded in the go tool. Signed-off-by: Andrew Hsu <andrewhsu@docker.com> * bump Dockerfile golang to 1.10.4 The latest golang version thus far. Signed-off-by: Andrew Hsu <andrewhsu@docker.com> * replace docker-entrypoint.sh with the gosec binary Signed-off-by: Andrew Hsu <andrewhsu@docker.com> * git ignore gosec binary Signed-off-by: Andrew Hsu <andrewhsu@docker.com> * refactor Dockerfile into multi-stage First stage does the build in a pristine alpine environment. Second stage is a minimal image with just the necessary stuff to run the compiled binary. Also added packages for gcc and musl-dev so cgo can do its thang. Signed-off-by: Andrew Hsu <andrewhsu@docker.com> * fix the image execution example in README.md Signed-off-by: Andrew Hsu <andrewhsu@docker.com>
48 lines
1.1 KiB
Makefile
48 lines
1.1 KiB
Makefile
GIT_TAG?= $(shell git describe --always --tags)
|
|
BIN = gosec
|
|
FMT_CMD = $(gofmt -s -l -w $(find . -type f -name '*.go' -not -path './vendor/*') | tee /dev/stderr)
|
|
IMAGE_REPO = securego
|
|
BUILDFLAGS := ''
|
|
CGO_ENABLED = 0
|
|
|
|
default:
|
|
$(MAKE) bootstrap
|
|
$(MAKE) build
|
|
|
|
bootstrap:
|
|
dep ensure
|
|
|
|
test: bootstrap
|
|
test -z '$(FMT_CMD)'
|
|
go vet $(go list ./... | grep -v /vendor/)
|
|
golint -set_exit_status $(shell go list ./... | grep -v vendor)
|
|
gosec ./...
|
|
ginkgo -r -v
|
|
|
|
build:
|
|
go build -o $(BIN) ./cmd/gosec/
|
|
|
|
clean:
|
|
rm -rf build vendor dist
|
|
rm -f release image bootstrap $(BIN)
|
|
|
|
release: bootstrap
|
|
@echo "Releasing the gosec binary..."
|
|
goreleaser release
|
|
|
|
build-linux:
|
|
CGO_ENABLED=$(CGO_ENABLED) GOOS=linux GOARCH=amd64 go build -ldflags $(BUILDFLAGS) -o $(BIN) ./cmd/gosec/
|
|
|
|
image:
|
|
@echo "Building the Docker image..."
|
|
docker build -t $(IMAGE_REPO)/$(BIN):$(GIT_TAG) .
|
|
docker tag $(IMAGE_REPO)/$(BIN):$(GIT_TAG) $(IMAGE_REPO)/$(BIN):latest
|
|
touch image
|
|
|
|
image-push: image
|
|
@echo "Pushing the Docker image..."
|
|
docker push $(IMAGE_REPO)/$(BIN):$(GIT_TAG)
|
|
docker push $(IMAGE_REPO)/$(BIN):latest
|
|
|
|
.PHONY: test build clean release image image-push
|
|
|