-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathDockerfile
45 lines (35 loc) · 1.66 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
FROM python:2.7.15-alpine3.9
LABEL description="ElastAlert suitable for Docker Kubernetes"
MAINTAINER [email protected]
#Elastalert的release版本号
ENV ELASTALERT_VERSION v0.1.38
ENV ELASTALERT_URL https://github.com/Yelp/elastalert/archive/${ELASTALERT_VERSION}.tar.gz
#Elasticsearch目录设置
ENV ELASTALERT_HOME /opt/elastalert
ENV ELASTALERT_CONFIG /opt/elastalert/config
ENV RULES_DIRECTORY /opt/elastalert/es_rules
ENV ELASTALERT_PLUGIN_DIRECTORY /opt/elastalert/elastalert_modules
#Elasticsearch 工作目录
WORKDIR /opt/elastalert
RUN apk --update upgrade && \
apk add curl tar musl-dev linux-headers gcc libffi-dev libffi openssl-dev tzdata && \
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
echo "Asia/Shanghai" > /etc/timezone && \
rm -rf /var/cache/apk/* && \
mkdir -p ${ELASTALERT_PLUGIN_DIRECTORY} && \
mkdir -p ${ELASTALERT_CONFIG} && \
mkdir -p ${RULES_DIRECTORY} && \
curl -Lo elastalert.tar.gz ${ELASTALERT_URL} && \
tar -zxvf elastalert.tar.gz -C ${ELASTALERT_HOME} --strip-components 1 && \
rm -rf elastalert.tar.gz && \
pip install "setuptools>=11.3" && \
pip install "elasticsearch>=5.0.0" && \
python setup.py install && \
apk del gcc libffi-dev musl-dev && \
echo "#!/bin/sh" >> /opt/elastalert/run.sh && \
echo "elastalert-create-index --no-ssl --no-verify-certs --config /opt/elastalert/config/config.yaml" >> run.sh && \
echo "elastalert --config /opt/elastalert/config/config.yaml" >> run.sh && \
chmod +x /opt/elastalert/run.sh
COPY ./elastalert_modules/* ${ELASTALERT_PLUGIN_DIRECTORY}/
# Launch Elastalert when a container is started.
CMD ["/bin/sh","run.sh"]