Skip to content

Commit

Permalink
docker: Use go get to fetch dependencies
Browse files Browse the repository at this point in the history
- Use proper GOPATH to avoid recurring dependencies
  • Loading branch information
nkprince007 committed May 24, 2018
1 parent c181654 commit faad296
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
FROM golang:alpine as build-env
LABEL MAINTAINER Naveen Kumar Sangi <naveenkumarsangi@protonmail.com>

RUN apk --no-cache add curl git
RUN curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
ENV SOURCE /go/src/app
RUN apk --no-cache add git
ENV SOURCE /go/src/gitlab.com/nkprince007/listen
RUN mkdir -p $SOURCE
ADD . $SOURCE
WORKDIR $SOURCE
RUN dep ensure -v
RUN go get -v ./...
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o app .


FROM alpine:latest

RUN apk --no-cache add ca-certificates
ENV SOURCE /go/src/gitlab.com/nkprince007/listen
WORKDIR /root/
COPY --from=build-env /go/src/app .
COPY --from=build-env $SOURCE .
CMD ["./app"]

0 comments on commit faad296

Please sign in to comment.