Skip to content

Commit

Permalink
docker: Use dep to download dependencies
Browse files Browse the repository at this point in the history
- Use golang:alpine base image
  • Loading branch information
nkprince007 committed May 23, 2018
1 parent 0c46e47 commit 35f1105
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
3 changes: 1 addition & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
vendor
Gopkg.lock
Gopkg.toml
.git
listen
13 changes: 9 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
FROM golang:onbuild
FROM golang:alpine as build-env
LABEL MAINTAINER Naveen Kumar Sangi <naveenkumarsangi@protonmail.com>
ENV SOURCE /go/src/gitlab.com/nkprince007/listen/

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


FROM alpine:latest

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

0 comments on commit 35f1105

Please sign in to comment.