Skip to content

Commit

Permalink
multistage build
Browse files Browse the repository at this point in the history
  • Loading branch information
george-angel committed Sep 19, 2018
1 parent 54c9cde commit 084404b
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
FROM alpine:3.8

ENV GOPATH=/go

FROM golang:alpine AS build
WORKDIR /go/src/app
COPY . /go/src/app/
RUN apk --no-cache add git gcc musl-dev &&\
go get ./... &&\
go test -v &&\
CGO_ENABLED=0 go build -o /ssh-key-manager .

RUN apk --no-cache add ca-certificates go git musl-dev \
&& go get ./... \
&& go test -v \
&& CGO_ENABLED=0 go build -o /ssh-key-manager . \
&& apk del go git musl-dev \
&& rm -rf $GOPATH

FROM alpine:3.8
RUN apk add --no-cache ca-certificates
COPY --from=build /ssh-key-manager /ssh-key-manager
CMD [ "/ssh-key-manager" ]

0 comments on commit 084404b

Please sign in to comment.