2016-11-17 44 views
2

我想dockerize外出包,我發現這裏...建築去包使用泊塢窗

https://github.com/siddontang/go-mysql-elasticsearch

泊塢窗圖像比去安裝所有服務器上就方便多了。但是下面的dockerfile不起作用。

FROM golang:1.6-onbuild 

RUN go get github.com/siddontang/go-mysql-elasticsearch 
RUN cd $GOPATH/src/github.com/siddontang/go-mysql-elasticsearch 
RUN make 

RUN ./bin/go-mysql-elasticsearch -config=./etc/river.toml 

如何使用簡潔的dockerfile直接從github構建go包?


更新

https://hub.docker.com/r/eaglechen/go-mysql-elasticsearch/

我找到確切的dockerfile會做到這一點。但該頁面上提到的docker命令不起作用。它並不啓動go軟件包,也不啓動容器。

回答

2

這取決於「not working」的意思,但RUN ./bin/...表示從當前工作目錄運行(/go/src/app in golang/1.6/onbuild/Dockerfile)。

而且go build in Makefile會把二進制的

$GOPATH/src/github.com/siddontang/go-mysql-elasticsearch/bin/... 

所以,你需要添加到您的Dockerfile:

WORKDIR $GOPATH/src/github.com/siddontang/go-mysql-elasticsearch