New dockerfile using alpine-glibc base image and make

This commit is contained in:
Steve Durrheimer 2015-06-20 15:14:08 +02:00
parent aea906123d
commit 2b025c0f49
1 changed files with 9 additions and 20 deletions

View File

@ -1,28 +1,17 @@
FROM alpine:3.2 FROM sdurrheimer/alpine-glibc
MAINTAINER The Prometheus Authors <prometheus-developers@googlegroups.com> MAINTAINER The Prometheus Authors <prometheus-developers@googlegroups.com>
ENV GOPATH=/go \ WORKDIR /app
REPO_PATH=github.com/prometheus/prometheus COPY . /app
COPY . /go/src/github.com/prometheus/prometheus
RUN apk add --update -t build-deps go git mercurial \ RUN apk add --update -t build-deps git mercurial bzr make \
&& apk add -u musl && rm -rf /var/cache/apk/* \ && make build \
&& cd /go/src/$REPO_PATH \ && cp prometheus promtool /bin/ \
&& cp -a ./Godeps/_workspace/* "$GOPATH" \
&& BUILD_FLAGS=" \
-X $REPO_PATH/version.Version $(cat version/VERSION) \
-X $REPO_PATH/version.Revision $(git rev-parse --short HEAD) \
-X $REPO_PATH/version.Branch $(git rev-parse --abbrev-ref HEAD) \
-X $REPO_PATH/version.BuildUser root@$(hostname -f) \
-X $REPO_PATH/version.BuildDate $(date +%Y%m%d-%H:%M:%S) \
-X $REPO_PATH/version.GoVersion $(go version | awk '{print substr($3,3)}')" \
&& go build -ldflags "$BUILD_FLAGS" -o /bin/prometheus $REPO_PATH/cmd/prometheus \
&& go build -ldflags "$BUILD_FLAGS" -o /bin/promtool $REPO_PATH/cmd/promtool \
&& mkdir -p /etc/prometheus \ && mkdir -p /etc/prometheus \
&& mv ./documentation/examples/prometheus.yml /etc/prometheus/prometheus.yml \ && mv ./documentation/examples/prometheus.yml /etc/prometheus/prometheus.yml \
&& mv ./console_libraries/ ./consoles/ /etc/prometheus/ \ && mv ./console_libraries/ ./consoles/ /etc/prometheus/ \
&& rm -rf /go \ && apk del --purge build-deps \
&& apk del --purge build-deps && rm -rf /app /var/cache/apk/*
EXPOSE 9090 EXPOSE 9090
VOLUME [ "/prometheus" ] VOLUME [ "/prometheus" ]