forked from jertel/elastalert2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
43 lines (34 loc) · 1.24 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
FROM python:slim-buster as builder
LABEL description="ElastAlert 2 Official Image"
LABEL maintainer="Jason Ertel"
COPY . /tmp/elastalert
RUN mkdir -p /opt/elastalert && \
cd /tmp/elastalert && \
pip install setuptools wheel && \
python setup.py sdist bdist_wheel
FROM python:slim-buster
ARG GID=1000
ARG UID=1000
ARG USERNAME=elastalert
COPY --from=builder /tmp/elastalert/dist/*.tar.gz /tmp/
RUN apt-get update && apt-get -y upgrade && \
apt-get install -y jq curl && \
apt-get -y autoremove && \
rm -rf /var/lib/apt/lists/* && \
pip install /tmp/*.tar.gz && \
rm -rf /tmp/* && \
mkdir -p /opt/elastalert && \
echo "#!/bin/sh" >> /opt/elastalert/run.sh && \
echo "set -e" >> /opt/elastalert/run.sh && \
echo "elastalert-create-index --config /opt/elastalert/config.yaml" \
>> /opt/elastalert/run.sh && \
echo "elastalert --config /opt/elastalert/config.yaml \"\$@\"" \
>> /opt/elastalert/run.sh && \
chmod +x /opt/elastalert/run.sh && \
groupadd -g ${GID} ${USERNAME} && \
useradd -u ${UID} -g ${GID} -M -b /opt/elastalert -s /sbin/nologin \
-c "ElastAlert 2 User" ${USERNAME}
USER ${USERNAME}
ENV TZ "UTC"
WORKDIR /opt/elastalert
ENTRYPOINT ["/opt/elastalert/run.sh"]