Skip to content

Commit

Permalink
docker: update for dep and use makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
travisjeffery committed Oct 12, 2017
1 parent 960d403 commit 6af135d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
16 changes: 3 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,13 @@
FROM golang:1.9-alpine

RUN apk update && apk upgrade && \
apk add --no-cache bash git openssh make

RUN go get -u github.com/kardianos/govendor
apk add --no-cache bash git openssh make && \
go get -u github.com/golang/dep/cmd/dep
ADD . /go/src/github.com/travisjeffery/jocko
WORKDIR /go/src/github.com/travisjeffery/jocko
RUN govendor sync
RUN govendor test -v -p=1 +local
RUN go build -o jocko cmd/jocko/main.go
RUN go build -o createtopic cmd/createtopic/main.go
RUN GOOS=linux GOARCH=amd64 make deps build

FROM alpine:latest

COPY --from=0 /go/src/github.com/travisjeffery/jocko/jocko /usr/local/bin/jocko
COPY --from=0 /go/src/github.com/travisjeffery/jocko/createtopic /usr/local/bin/createtopic

EXPOSE 9092 9093 9094

VOLUME "/tmp/jocko"

CMD ["jocko"]
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
BUILD_PATH := jocko
DOCKER_TAG := latest

all: deps test
.PHONY: all
Expand All @@ -7,6 +9,12 @@ deps:
@which dep 2>/dev/null || go get -u github.com/golang/dep/cmd/dep
dep ensure

build:
go build -o $(BUILD_PATH) cmd/jocko/main.go

build-docker:
docker build -t travisjeffery/jocko:$(DOCKER_TAG) .

.PHONY: test
test:
go test -v ./...
Expand Down

0 comments on commit 6af135d

Please sign in to comment.