From 7b8fd9c7a51e79dd6c928d1fcf0c6af0ab657c41 Mon Sep 17 00:00:00 2001 From: Johannes 'fish' Ziemke Date: Mon, 12 Jan 2015 15:05:36 +0100 Subject: [PATCH 1/2] Read version from VERSION file Change-Id: Idfbe2dbe6cb8cd90c6c728dca7d10ff580c7b9d6 --- Makefile.INCLUDE | 2 +- VERSION | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 VERSION diff --git a/Makefile.INCLUDE b/Makefile.INCLUDE index fa79d0f0bc..799c004359 100644 --- a/Makefile.INCLUDE +++ b/Makefile.INCLUDE @@ -15,7 +15,7 @@ .SUFFIXES: -VERSION=0.9.0rc3 +VERSION=$(shell cat `git rev-parse --show-toplevel`/VERSION) OS=$(shell uname) ARCH=$(shell uname -m) diff --git a/VERSION b/VERSION new file mode 100644 index 0000000000..7bef126c57 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.9.0rc3 From 8a7289ce55390765c074df8a7fb633c16e5055e1 Mon Sep 17 00:00:00 2001 From: Johannes 'fish' Ziemke Date: Mon, 12 Jan 2015 15:15:26 +0100 Subject: [PATCH 2/2] Use golang base image and not make Instead of using make to install all dependencies, this uses the golang base image. This way those common base layers can be shared across other golang based images. This also stops using the Makefile to install the dependencies because we would have to install all dependencies everytime something changes. Change-Id: I5e143cc4ec3e5c9027ec4912be12297e704ffff5 --- Dockerfile | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index da55b34c43..250b4d25db 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,27 @@ -FROM ubuntu:13.10 +FROM golang:1.4 MAINTAINER Prometheus Team +RUN apt-get -qy update && apt-get -qy install vim-common gcc mercurial && \ + go get github.com/tools/godep + +WORKDIR /go/src/github.com/prometheus/prometheus +ADD . /go/src/github.com/prometheus/prometheus + +RUN godep restore && go get -d +RUN ./utility/embed-static.sh web/static web/templates | gofmt > web/blob/files.go + +RUN go build -ldflags " \ + -X main.buildVersion $(cat VERSION) \ + -X main.buildRevision $(git rev-parse --short HEAD) \ + -X main.buildBranch $(git rev-parse --abbrev-ref HEAD) \ + -X main.buildUser root \ + -X main.buildDate $(date +%Y%m%d-%H:%M:%S) \ + -X main.goVersion $GOLANG_VERSION \ + " +RUN cd tools/rule_checker && go build +ADD ./documentation/examples/prometheus.conf /prometheus.conf + EXPOSE 9090 VOLUME [ "/prometheus" ] WORKDIR /prometheus - -ENTRYPOINT [ "/prometheus-src/prometheus" ] -CMD [ "-config.file=/prometheus.conf" ] -RUN apt-get update && apt-get install -yq make git curl sudo mercurial vim-common gcc -ADD . /prometheus-src -RUN cd /prometheus-src && make tools binary -ADD ./documentation/examples/prometheus.conf /prometheus.conf +ENTRYPOINT [ "/go/src/github.com/prometheus/prometheus/prometheus" ] +CMD [ "-logtostderr", "-config.file=/prometheus.conf" ]