-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #46 from sevagh/improvements
Improvements
- Loading branch information
Showing
3,673 changed files
with
298 additions
and
2,285,381 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
goat | ||
pkg/ | ||
bin/ |
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,37 @@ | ||
FROM golang:1.11-stretch as build | ||
|
||
ENV REPO sevagh/goat | ||
ENV GO111MODULE=on | ||
|
||
RUN apt-get update -y &&\ | ||
apt-get install -y zip | ||
|
||
COPY . /go/src/github.com/$REPO | ||
WORKDIR /go/src/github.com/$REPO | ||
|
||
RUN make build zip tarball | ||
|
||
FROM fedora as rpmbuild | ||
|
||
RUN dnf update -y &&\ | ||
dnf install -y make rpm-build alien | ||
|
||
COPY ./rpm /goat-rpm-pkg/ | ||
|
||
COPY --from=build /go/src/github.com/sevagh/goat/bin/goat /goat-rpm-pkg/goat | ||
COPY --from=build /go/src/github.com/sevagh/goat/bin/version-file /goat-rpm-pkg/version-file | ||
|
||
WORKDIR goat-rpm-pkg | ||
|
||
RUN make rpm | ||
|
||
WORKDIR /root/rpmbuild/RPMS/x86_64/ | ||
|
||
RUN alien ./*.rpm | ||
|
||
FROM alpine | ||
|
||
COPY --from=build /go/src/github.com/sevagh/goat/pkg /_goat-pkg | ||
COPY --from=rpmbuild /root/rpmbuild/RPMS/x86_64/* /_goat-pkg/ | ||
|
||
CMD cp _goat-pkg/* goat-pkg/ |
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,67 +1,47 @@ | ||
NAME:=goat | ||
VERSION:=1.0.0 | ||
VERSION:=$(shell git describe --tags) | ||
OS:=linux | ||
ARCH:=amd64 | ||
GOAT_FILES?=$$(find . -name '*.go' | grep -v vendor) | ||
BINPATH=usr/sbin | ||
GOAT_FILES:=$$(find . -name '*.go' | grep -v vendor) | ||
BINPATH:=$(PWD)/bin | ||
PKGDIR?=$(PWD)/pkg | ||
DEBIANDIR:=debian/$(NAME)-$(VERSION) | ||
|
||
all: build | ||
|
||
build: deps | ||
docker-build: | ||
mkdir -p $(PKGDIR) | ||
docker build --no-cache -t "goat-builder" -f Dockerfile.build . | ||
docker run -v $(PKGDIR):/goat-pkg goat-builder | ||
|
||
build: | ||
CGO_ENABLED=0 GOOS=$(OS) GOARCH=$(ARCH) go build -a -tags netgo -ldflags '-w -extldflags "-static" -X main.VERSION=$(VERSION)' -o $(BINPATH)/$(NAME) | ||
strip $(BINPATH)/$(NAME) | ||
echo $(VERSION) > $(BINPATH)/version-file | ||
|
||
test: | ||
@go vet ./... | ||
@go test -v ./... | ||
|
||
deps: | ||
@command -v dep 2>&1 >/dev/null || go get -u github.com/golang/dep/cmd/dep | ||
@dep ensure -v | ||
|
||
fmt: | ||
@gofmt -s -w $(GOAT_FILES) | ||
|
||
lint: | ||
-gometalinter.v2 --enable-all $(GOAT_FILES) --exclude=_test.go | ||
pkgclean: | ||
rm -rf $(PKGDIR) | ||
|
||
package_all: pkgclean build deb rpm zip | ||
tarball: | ||
@tar -czf $(PKGDIR)/$(NAME)_$(VERSION)_$(OS)_$(ARCH).tar.gz -C $(BINPATH) $(NAME) | ||
|
||
zip: | ||
@zip pkg/$(NAME)_$(VERSION)_$(OS)_$(ARCH).zip -j $(BINPATH)/$(NAME) | ||
|
||
deb: | ||
@mkdir -p pkg | ||
fpm -s dir -t deb -n $(NAME) -v $(VERSION) -C . \ | ||
-p pkg/$(NAME)_VERSION_ARCH.deb \ | ||
-d "mdadm" \ | ||
--deb-systemd ./goat@.service \ | ||
$(BINPATH) | ||
@zip $(PKGDIR)/$(NAME)_$(VERSION)_$(OS)_$(ARCH).zip -j $(BINPATH)/$(NAME) | ||
|
||
rpm: | ||
@mkdir -p pkg | ||
fpm -s dir -t rpm -n $(NAME) -v $(VERSION) -C . \ | ||
-p pkg/$(NAME)_VERSION_ARCH.rpm \ | ||
-d "mdadm" \ | ||
--rpm-systemd ./goat@.service \ | ||
$(BINPATH) | ||
|
||
pkgclean: | ||
@rm -rf pkg | ||
test: | ||
@go test -v ./... | ||
|
||
lintsetup: | ||
@go get -u gopkg.in/alecthomas/gometalinter.v2 | ||
@gometalinter.v2 --install 2>&1 >/dev/null | ||
@go install ./... | ||
fmt: | ||
@gofmt -s -w $(GOAT_FILES) | ||
|
||
dev-env: ## Build a local development environment using Docker | ||
@docker run -it --rm \ | ||
-v $(shell pwd):/go/src/github.com/sevagh/$(NAME) \ | ||
-w /go/src/github.com/sevagh/$(NAME) \ | ||
golang:1.10 \ | ||
/bin/bash -c 'make deps; make install; bash' | ||
golang:1.11 \ | ||
/bin/bash -c 'make install; bash' | ||
|
||
install: ## Build and install locally the binary (dev purpose) | ||
go install . | ||
|
||
.PHONY: dev-env clean install test | ||
.PHONY: docker-build dev-env clean install test |
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.