Skip to content

Commit

Permalink
Convert to docker multistage Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
brancz committed Jan 9, 2019
1 parent 77e0acc commit ca2a679
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM openshift/origin-base
FROM openshift/origin-release:golang-1.10 AS builder

ENV GOPATH="/go"
ENV GOBIN="${GOPATH}/bin"
Expand All @@ -7,12 +7,20 @@ RUN mkdir -p $GOBIN

COPY . $GOPATH/src/github.com/grafana/grafana

RUN yum install -y golang make git && \
cd $GOPATH/src/github.com/grafana/grafana && \
go run build.go build && \
cp $GOPATH/src/github.com/grafana/grafana/bin/linux-$(go env GOARCH)/grafana-server /usr/bin/ && \
yum autoremove -y golang make git && yum clean all && \
rm -rf .git
#RUN yum install -y make git
RUN cd $GOPATH/src/github.com/grafana/grafana && go run build.go build
RUN cp $GOPATH/src/github.com/grafana/grafana/bin/linux-$(go env GOARCH)/grafana-server /usr/bin/
RUN rm -rf $GOPATH/src/github.com/grafana/grafana/.git

FROM openshift/origin-base

ENV GOPATH="/go"
ENV GOBIN="${GOPATH}/bin"
ENV PATH="${GOBIN}:${PATH}"
RUN mkdir -p $GOBIN

COPY --from=builder /usr/bin/grafana-server /usr/bin/grafana-server
COPY --from=builder $GOPATH/src/github.com/grafana/grafana $GOPATH/src/github.com/grafana/grafana

LABEL io.k8s.display-name="Grafana" \
io.k8s.description="" \
Expand Down

0 comments on commit ca2a679

Please sign in to comment.