astaphobia
9/16/2018 - 10:46 AM

Dockerfile golang image with dep

Dockerfile golang image with dep

FROM golang

WORKDIR ${GOPATH} 

#make sure where is the GOPATH it is
RUN echo ${GOPATH}

COPY . /go/myproject/api

# check dep is already installed before install it
RUN [ -f /usr/local/bin/dep ] && echo 'Dep has ben installed' where dep || \
go get github.com/golang/dep && go install github.com/golang/dep/cmd/dep

RUN dep ensure -v

CMD ['go run', 'main.go']