Skip to content

Commit

Permalink
Add Dockerfile, Makefile and travis configuration. (#8)
Browse files Browse the repository at this point in the history
* Add Dockerfile.

There was also a missing dependency when I tried to build the project,
so I added it.

Signed-off-by: David Calavera <david.calavera@gmail.com>

* Add Makefile and travis configuration.

Signed-off-by: David Calavera <david.calavera@gmail.com>

* Use make to build the binary.

Signed-off-by: David Calavera <david.calavera@gmail.com>

* Do not require sudo on travis.

Signed-off-by: David Calavera <david.calavera@gmail.com>

* Install dependencies in the install phase.

Signed-off-by: David Calavera <david.calavera@gmail.com>

* Skip vendor from tests.

Signed-off-by: David Calavera <david.calavera@gmail.com>
  • Loading branch information
calavera committed Sep 15, 2016
1 parent 59f8dac commit b2efa1d
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 29 deletions.
8 changes: 8 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
language: go

go:
- 1.7

install: make deps
script: make all
7 changes: 7 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM calavera/go-glide:v0.12.2

ADD . /go/src/github.com/netlify/gocommerce

RUN cd /go/src/github.com/netlify/gocommerce && make deps build && mv gocommerce /usr/local/bin/

CMD ["gocommerce"]
18 changes: 18 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.PONY: all build deps image test

help: ## Show this help.
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {sub("\\\\n",sprintf("\n%22c"," "), $$2);printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)

all: test build ## Run the tests and build the binary.

build: ## Build the binary.
go build

deps: ## Install dependencies.
go get -u github.com/Masterminds/glide && glide install

image: ## Build the Docker image.
docker build .

test: ## Run tests.
go test -v $(go list ./... | grep -v /vendor/)
85 changes: 56 additions & 29 deletions glide.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions glide.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import:
- context
- package: gopkg.in/gomail.v2
version: 2.0.0
- package: github.com/mattes/vat
testImport:
- package: github.com/stretchr/testify
version: v1.1.3
Expand Down

0 comments on commit b2efa1d

Please sign in to comment.