Skip to content

Commit

Permalink
Merge pull request #12 from moul/fix-7
Browse files Browse the repository at this point in the history
Fix #7
  • Loading branch information
moul committed Oct 10, 2015
2 parents 4903fe6 + b8785aa commit 76be79f
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
gotty-client
/dist

# Compiled Object files, Static and Dynamic libs (Shared Objects)
Expand Down
61 changes: 61 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
COMMANDS := $(addprefix ./,$(wildcard cmd/*))
PACKAGES := .
VERSION := $(shell cat .goxc.json | jq -c .PackageVersion | sed 's/"//g')
SOURCES := $(shell find . -name "*.go")
GOTTY_URL := http://localhost:8080


.PHONY: build
build: $(notdir $(COMMANDS))


.PHONY: build-docker
build-docker: contrib/docker/.docker-container-built


.PHONY: clean
clean:
rm -f $(notdir $(COMMANDS))


.PHONY: install
install:
go install $(COMMANDS)


.PHONY: release
release:
goxc


.PHONY: build-docker
build-docker: contrib/docker/.docker-container-built


.PHONY: run-docker
run-docker: build-docker
docker run -it --rm moul/gotty-client $(GOTTY_URL)


$(notdir $(COMMANDS)): $(SOURCES)
gofmt -w $(PACKAGES) ./cmd/$@
go test -i $(PACKAGES) ./cmd/$@
go build -o $@ ./cmd/$@
@# ./$@ --version


dist/latest/gotty-client_latest_linux_386: $(SOURCES)
mkdir -p dist
rm -f dist/latest
(cd dist; ln -s $(VERSION) latest)
goxc -bc="linux,386" xc
cp dist/latest/gotty-client_$(VERSION)_linux_386 dist/latest/gotty-client_latest_linux_386


contrib/docker/.docker-container-built: dist/latest/gotty-client_latest_linux_386
cp dist/latest/gotty-client_latest_linux_386 contrib/docker/gotty-client
docker build -t moul/gotty-client:latest contrib/docker
docker tag moul/gotty-client:latest moul/gotty-client:$(VERSION)
docker run -it --rm moul/gotty-client --version
docker inspect --type=image --format="{{ .Id }}" moul/gotty-client > $@.tmp
mv $@.tmp $@
5 changes: 5 additions & 0 deletions contrib/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM scratch

ADD ./gotty-client /gotty-client

ENTRYPOINT ["/gotty-client"]

0 comments on commit 76be79f

Please sign in to comment.