Browse Source

Dockerfile and Makefile

pull/1943/head
Anton Kaliaev 7 years ago
parent
commit
94b8e28b21
No known key found for this signature in database GPG Key ID: 7B6881D965918214
3 changed files with 52 additions and 4 deletions
  1. +9
    -0
      tm-monitor/Dockerfile
  2. +41
    -4
      tm-monitor/Makefile
  3. +2
    -0
      tm-monitor/main.go

+ 9
- 0
tm-monitor/Dockerfile View File

@ -0,0 +1,9 @@
FROM alpine:3.5
WORKDIR /app
COPY tm-monitor /app/tm-monitor
# look for local Tendermint node by default
CMD ["localhost:46657"]
ENTRYPOINT ["./tm-monitor"]

+ 41
- 4
tm-monitor/Makefile View File

@ -1,11 +1,48 @@
DIST_DIRS := find * -type d -exec
VERSION := $(shell perl -ne '/^var version.*"([^"]+)".*$$/ && print "v$$1\n"' main.go)
GOTOOLS = \
github.com/Masterminds/glide
github.com/Masterminds/glide \
github.com/mitchellh/gox
tools:
go get -v $(GOTOOLS)
get_deps: tools
@echo "--> Running glide install"
@glide install
glide install
.PHONY: get_deps
build:
go build -ldflags "-X main.version=${VERSION}"
install:
go install -ldflags "-X main.version=${VERSION}"
test:
go test
build-all: tools
gox -verbose \
-ldflags "-X main.version=${VERSION}" \
-os="linux darwin windows freebsd openbsd netbsd" \
-arch="amd64 386 armv5 armv6 armv7 arm64" \
-osarch="!darwin/arm64" \
-output="dist/{{.OS}}-{{.Arch}}/{{.Dir}}" .
dist: build-all
cd dist && \
$(DIST_DIRS) cp ../LICENSE {} \; && \
$(DIST_DIRS) cp ../README.md {} \; && \
$(DIST_DIRS) tar -zcf tm-monitor-${VERSION}-{}.tar.gz {} \; && \
$(DIST_DIRS) zip -r tm-monitor-${VERSION}-{}.zip {} \; && \
cd ..
build-docker:
rm -f ./tm-monitor
docker run -it --rm -v "$(PWD):/go/src/app" -w "/go/src/app" -e "CGO_ENABLED=0" golang:alpine go build -ldflags "-X main.version=${VERSION}" -o tm-monitor
docker build -t "tendermint/tm-monitor" .
clean:
rm -f ./tm-monitor.log
rm -f ./tm-monitor
rm -rf ./dist
.PHONY: tools get_deps build install test build-all dist clean build-docker

+ 2
- 0
tm-monitor/main.go View File

@ -11,6 +11,8 @@ import (
log15 "github.com/tendermint/log15"
)
var version = "0.2.0"
var log = logger.New()
func main() {


Loading…
Cancel
Save