Merge pull request #92 from sdurrheimer/master

New Dockerfile using alpine-golang-make-onbuild base image
This commit is contained in:
Julius Volz 2015-07-12 13:16:48 -06:00
commit 7859ccb570
3 changed files with 34 additions and 27 deletions

View File

@ -1,19 +1,10 @@
FROM golang:latest
MAINTAINER Prometheus Team <prometheus-developers@googlegroups.com>
FROM sdurrheimer/alpine-golang-make-onbuild
MAINTAINER Prometheus Team <prometheus-developers@googlegroups.com>
RUN apt-get -qy update && apt-get -qy install vim-common
ENV PKGPATH $GOPATH/src/github.com/prometheus/alertmanager
ENV GOROOT /usr/src/go
USER root
RUN mkdir /alertmanager \
&& chown golang:golang /alertmanager
ADD . $PKGPATH
RUN cd $PKGPATH \
&& go get -d \
&& make \
&& rm -rf $PKGPATH/.deps \
&& mkdir /alertmanager \
&& chown nobody /alertmanager
USER nobody
WORKDIR /alertmanager
ENTRYPOINT [ "/go/src/github.com/prometheus/alertmanager/alertmanager" ]
EXPOSE 9093
USER golang
WORKDIR /alertmanager
EXPOSE 9093

View File

@ -49,19 +49,22 @@ ifeq ($(GOOS),darwin)
endif
GO_VERSION ?= 1.4.2
ifeq ($(shell type go >/dev/null && go version | sed 's/.*go\([0-9.]*\).*/\1/'), $(GO_VERSION))
GOROOT := $(shell go env GOROOT)
else
GOROOT := $(CURDIR)/.build/go$(GO_VERSION)
endif
GOURL ?= https://golang.org/dl
GOPKG ?= go$(GO_VERSION).$(GOOS)-$(GOARCH)$(RELEASE_SUFFIX).tar.gz
GOPATH := $(CURDIR)/.build/gopath
GOCC ?= $(GOROOT)/bin/go
GO ?= GOROOT=$(GOROOT) GOPATH=$(GOPATH) $(GOCC)
GOFMT ?= $(GOROOT)/bin/gofmt
# Check for the correct version of go in the path. If we find it, use it.
# Otherwise, prepare to build go locally.
ifeq ($(shell command -v "go" >/dev/null && go version | sed -e 's/^[^0-9.]*\([0-9.]*\).*/\1/'), $(GO_VERSION))
GOCC ?= $(shell command -v "go")
GOFMT ?= $(shell command -v "gofmt")
GO ?= GOPATH=$(GOPATH) $(GOCC)
else
GOROOT ?= $(CURDIR)/.build/go$(GO_VERSION)
GOCC ?= $(GOROOT)/bin/go
GOFMT ?= $(GOROOT)/bin/gofmt
GO ?= GOROOT=$(GOROOT) GOPATH=$(GOPATH) $(GOCC)
endif
# Never honor GOBIN, should it be set at all.
unexport GOBIN

View File

@ -75,3 +75,16 @@ are going to be addressed in the future:
configurable amount of time for A to start firing as well before sending
notifications for B. This is not yet supported.
* Alertmanager has not been tested or optimized for high alert loads yet.
## Using Docker
You can deploy the Alertmanager using the [prom/alertmanager](https://registry.hub.docker.com/u/prom/alertmanager/) Docker image.
For example:
```bash
docker pull prom/alertmanager
docker run -d -p 9093:9093 -v $PWD/alertmanager.conf:/alertmanager.conf \
prom/alertmanager -config.file=/alertmanager.conf
```