-
Notifications
You must be signed in to change notification settings - Fork 177
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
33 changed files
with
2,280 additions
and
1,306 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
language: go | ||
go_import_path: github.com/cloudflare/goflow | ||
go: | ||
- 1.12.x | ||
|
||
script: | ||
- GO111MODULE=on make | ||
|
||
notifications: | ||
email: | ||
recipients: | ||
- louis@cloudflare.com | ||
on_success: never | ||
on_failure: change | ||
|
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 |
---|---|---|
@@ -1,24 +1,19 @@ | ||
ARG src_dir="/go/src/github.com/cloudflare/goflow" | ||
|
||
FROM golang:alpine as builder | ||
ARG src_dir | ||
ARG VERSION="" | ||
|
||
RUN apk --update --no-cache add git && \ | ||
mkdir -p ${src_dir} | ||
RUN apk --update --no-cache add git build-base gcc | ||
|
||
WORKDIR ${src_dir} | ||
COPY . . | ||
COPY . /build | ||
WORKDIR /build | ||
|
||
RUN go get -u github.com/golang/dep/cmd/dep && \ | ||
dep ensure && \ | ||
go build | ||
RUN go build -ldflags "-X main.version=${VERSION}" -o goflow cmd/goflow/goflow.go | ||
|
||
FROM alpine:latest | ||
ARG src_dir | ||
|
||
RUN apk update --no-cache && \ | ||
adduser -S -D -H -h / flow | ||
USER flow | ||
COPY --from=builder ${src_dir}/goflow / | ||
COPY --from=builder /build/goflow / | ||
|
||
ENTRYPOINT ["./goflow"] |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,4 +1,48 @@ | ||
IMAGE ?= cloudflare/goflow | ||
VERSION ?= $(shell git describe --tags --always --dirty) | ||
VERSION_DOCKER ?= $(shell git describe --tags --abbrev=0 --always --dirty) | ||
|
||
GOOS ?= linux | ||
ARCH ?= $(shell uname -m) | ||
|
||
.PHONY: all | ||
all: test-race vet test | ||
|
||
.PHONY: clean | ||
clean: | ||
rm -rf bin | ||
|
||
.PHONY: build | ||
build: | ||
@echo compiling code | ||
mkdir bin | ||
GOOS=$(GOOS) go build -ldflags '-X main.version=$(VERSION)' -o bin/goflow-$(GOOS)-$(ARCH) cmd/goflow/goflow.go | ||
GOOS=$(GOOS) go build -ldflags '-X main.version=$(VERSION)' -o bin/goflow-sflow-$(GOOS)-$(ARCH) cmd/csflow/csflow.go | ||
GOOS=$(GOOS) go build -ldflags '-X main.version=$(VERSION)' -o bin/goflow-netflow-$(GOOS)-$(ARCH) cmd/cnetflow/cnetflow.go | ||
GOOS=$(GOOS) go build -ldflags '-X main.version=$(VERSION)' -o bin/goflow-nflegacy-$(GOOS)-$(ARCH) cmd/cnflegacy/cnflegacy.go | ||
|
||
|
||
.PHONY: container | ||
container: | ||
@echo build docker container | ||
docker build --build-arg VERSION=$(VERSION) -t $(IMAGE):$(VERSION_DOCKER) . | ||
|
||
.PHONY: proto | ||
proto: | ||
@echo generating protobuf | ||
protoc --go_out=. --plugin=$(PROTOCPATH)protoc-gen-go pb/*.proto | ||
|
||
.PHONY: test | ||
test: | ||
@echo testing code | ||
go test ./... | ||
|
||
.PHONY: vet | ||
vet: | ||
@echo checking code is vetted | ||
go vet $(shell go list ./...) | ||
|
||
proto: | ||
protoc $$PROTO_PATH --go_out=. pb/flow.proto | ||
.PHONY: test-race | ||
test-race: | ||
@echo testing code for races | ||
go test -race ./... |
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.