shantanuo
shantanuo

Reputation: 32220

building go package using docker

I am trying to dockerize the go package that I found here...

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

The docker image is much more convenient than installing go on all the servers. But the following dockerfile is not working.

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

How do I build a go package directly from github using a concise dockerfile?


Update

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

I found the exact dockerfile that would do this. But the docker command mentioned on that page does not work. It does not start the go package nor does it start the container.

Upvotes: 2

Views: 260

Answers (2)

VonC
VonC

Reputation: 1329592

It depends on what you mean by "not working", but RUN ./bin/... means RUN from the current working directory (/go/src/app in golang/1.6/onbuild/Dockerfile).

And go build in Makefile would put the binary in

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

So you need to add to your Dockerfile:

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

Upvotes: 2

shantanuo
shantanuo

Reputation: 32220

I guess this should do what I am looking for.

https://github.com/EagleChen/docker_go_mysql_elasticsearch

And I hope one day I will learn to use that little search box.

Upvotes: 0

Related Questions