use alpine as base for build stage

This commit is contained in:
Michael Rennecke 2017-08-06 22:12:19 +02:00
parent 6754c7e34f
commit 99f0118017
1 changed files with 7 additions and 4 deletions

View File

@ -1,11 +1,14 @@
FROM golang:1.8 as builder
# Stage: Build
FROM golang:1.8-alpine as builder
ENV VERSION=0.8.0
RUN mkdir -p /go/src
RUN set -x \
&& apk --update add git
RUN set -x \
&& mkdir -p /go/src \
&& cd /go/src \
&& git clone https://github.com/go-graphite/carbonapi.git
@ -15,10 +18,10 @@ RUN git checkout ${VERSION}
RUN go-wrapper download
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o carbonapi .
RUN go build
# Stage: Run
FROM alpine
COPY --from=builder /go/src/carbonapi/carbonapi /sbin/