icinga2-container/Dockerfile

72 lines
2.8 KiB
Docker
Raw Normal View History

2016-04-29 19:07:22 +00:00
FROM alpine:edge
# 1. common tools
# 2. programing languages
# 3. icinga2 stuff
# 4. letsencrypt deps
RUN apk add --no-cache --update \
bind-tools tcpdump openssh lsof curl wget git mercurial strace tmux vim rsync htop bash openssl \
ruby python go build-base \
nginx postgresql icinga2 \
py-requests py-setuptools && \
mkdir -p /run/nginx
## S6 supervisor
RUN curl -sSL https://github.com/just-containers/s6-overlay/releases/download/v1.17.2.0/s6-overlay-amd64.tar.gz | tar -xzf - -C /
## Influxdb
RUN export GOPATH=/tmp/go \
&& mkdir -p /etc/influxdb/ $GOPATH/src/github.com/influxdata \
&& curl -sSL https://github.com/influxdata/influxdb/archive/v0.12.2.tar.gz | tar -xzf - -C /tmp \
&& mv /tmp/influxdb-* $GOPATH/src/github.com/influxdata/influxdb \
&& cd $GOPATH/src/github.com/influxdata/influxdb \
&& go get github.com/sparrc/gdm \
&& export PATH=$GOPATH/bin:$PATH \
&& gdm restore \
&& go install ./... \
&& cp $GOPATH/bin/influx* /usr/bin/ \
&& rm -rf $GOPATH
## Grafana
RUN apk add --no-cache nodejs \
&& export GOPATH=/tmp/go \
&& mkdir -p /opt/grafana/conf $GOPATH/src/github.com/grafana/ \
&& curl -sSL https://github.com/grafana/grafana/archive/v3.0-beta5.tar.gz | tar -xzf - -C /tmp \
&& mv /tmp/grafana-* $GOPATH/src/github.com/grafana/grafana \
&& cd $GOPATH/src/github.com/grafana/grafana \
&& go run build.go setup \
&& $GOPATH/bin/godep restore \
&& go run build.go build \
&& npm install \
&& npm install -g grunt-cli \
&& grunt \
&& npm uninstall -g grunt-cli \
&& npm cache clear \
&& cp -a $GOPATH/src/github.com/grafana/grafana/bin/* /usr/bin/ \
&& cp -ra $GOPATH/src/github.com/grafana/grafana/public_gen /opt/grafana/public \
&& apk del --purge nodejs \
&& rm -rf $GOPATH /root/.npm* \
&& addgroup -g 45555 grafana \
&& adduser -u 45555 -G grafana -D grafana
## simp_le
RUN apk --no-cache add libffi-dev python-dev openssl-dev && \
mkdir -p /tmp/simp_le /etc/ssl/letsencrypt && \
curl -sSL https://github.com/kuba/simp_le/archive/master.tar.gz | tar -xzf - -C /tmp && \
cd /tmp/simp_le-master && \
python ./setup.py install && \
rm -rf /tmp/simp_le-master && apk del git py-pip libffi-dev python-dev openssl-dev && \
echo "3 10 * * * /usr/bin/update-certs" >> /etc/crontabs/root
## temporary keys until letsencrypt certificate is generated
RUN cd /etc/ssl/letsencrypt && \
openssl req -x509 -newkey rsa:2048 -keyout nginx/key.pem -out nginx/fullchain.pem -days 5 && \
cat nginx/key.pem nginx/fullchain.pem > influxdb/combined.pem
RUN icinga2 feature enable ido-pgsql
VOLUME [ "/var/lib/influxdb/data", "/var/lib/influxdb/meta", "/var/lib/postgres/", "/var/lib/grafana", "/etc/grafana", "/etc/icinga2", "/etc/icinga-web", "/etc/icingaweb2", "/var/lib/icinga2", "/etc/ssmtp"]
EXPOSE 22 80 443
ADD . /
ENTRYPOINT ["/init"]