-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
65 lines (50 loc) · 1.61 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# Use official Logstash image.
FROM logstash:2.1.0
############
# Timezone #
############
ENV TZ="Europe/Berlin"
RUN echo "${TZ}" | tee /etc/timezone && \
dpkg-reconfigure --frontend noninteractive tzdata
##########################################
# Install packages and templating script #
##########################################
ENV \
JINJA_SCRIPT="render_jinja_template.py" \
REPO_PROD_BRANCH="master"
# Install packages and clean-up.
RUN apt-get update && apt-get install -y \
curl build-essential \
python-setuptools && \
easy_install Jinja2 && \
apt-get -y clean && \
rm -rf /var/lib/apt/lists/*
# Add Jinja templating script from repo epages-infra.
COPY ${JINJA_SCRIPT} /
RUN \
chown logstash:logstash ${JINJA_SCRIPT} && \
chmod +x ${JINJA_SCRIPT}
######################
# Configure Logstash #
######################
ENV \
LS_CONFIG_VOL="/usr/share/logstash/config" \
LS_LOG_VOL="/usr/share/logstash/log"
# Create config and log dir
RUN mkdir -p ${LS_CONFIG_VOL} ${LS_LOG_VOL}
# Copy whole config dir to config vol
COPY config/ ${LS_CONFIG_VOL}/
# Change ownership to logstash
RUN chown -R logstash:logstash ${LS_CONFIG_VOL} ${LS_LOG_VOL}
# Set volume mount points
VOLUME ["${LS_CONFIG_VOL}", "${LS_LOG_VOL}"]
# Remove inherited offical entrypoint script
RUN rm /docker-entrypoint.sh
# Use our own entrypoint script that changes file ownerships and renders jinja templates
COPY docker-entrypoint.sh /
RUN \
chown logstash:logstash /docker-entrypoint.sh && \
chmod +x /docker-entrypoint.sh
ENTRYPOINT ["/docker-entrypoint.sh"]
# Set default command and default option suffix
CMD ["logstash", "agent"]