-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
47 lines (38 loc) · 2.01 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#------------------------------------------------------------------------------
# Set the base image for subsequent instructions:
#------------------------------------------------------------------------------
FROM golang:1.8-alpine
MAINTAINER Marc Villacorta Morera <[email protected]>
#------------------------------------------------------------------------------
# Environment variables:
#------------------------------------------------------------------------------
ENV VERSION="1.7.1"
#------------------------------------------------------------------------------
# Build and install:
#------------------------------------------------------------------------------
RUN apk add -U --no-cache -t dev git make gcc musl-dev \
&& mkdir -p ${GOPATH}/src/github.com/prometheus \
&& cd ${GOPATH}/src/github.com/prometheus \
&& git clone https://github.com/prometheus/prometheus.git \
&& cd prometheus && git checkout v${VERSION} -b build \
&& make build && mv prometheus promtool /usr/local/bin \
&& mkdir /etc/prometheus /usr/share/prometheus \
&& mv console* /usr/share/prometheus \
&& ln -s /usr/share/prometheus/console* /etc/prometheus \
&& cp documentation/examples/prometheus.yml /etc/prometheus \
&& apk del --purge dev && rm -rf /tmp/* /go /usr/local/go
#------------------------------------------------------------------------------
# Volumes:
#------------------------------------------------------------------------------
VOLUME [ "/etc/prometheus", \
"/var/lib/prometheus" ]
#------------------------------------------------------------------------------
# Entrypoint and CMD:
#------------------------------------------------------------------------------
WORKDIR "/"
EXPOSE 9090
ENTRYPOINT [ "prometheus" ]
CMD [ "-config.file=/etc/prometheus/prometheus.yml", \
"-storage.local.path=/var/lib/prometheus", \
"-web.console.libraries=/etc/prometheus/console_libraries", \
"-web.console.templates=/etc/prometheus/consoles" ]