forked from DataDog/docker-dd-agent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile-alpine
55 lines (44 loc) · 1.85 KB
/
Dockerfile-alpine
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
FROM alpine:3.4
MAINTAINER Datadog <[email protected]>
ENV DD_HOME=/opt/datadog-agent \
# prevent the agent from being started after install
DD_START_AGENT=0 \
DOCKER_DD_AGENT=yes \
PYCURL_SSL_LIBRARY=openssl \
AGENT_VERSION=5.16.0 \
DD_ETC_ROOT="/opt/datadog-agent/agent" \
PATH="/opt/datadog-agent/venv/bin:/opt/datadog-agent/agent/bin:$PATH" \
PYTHONPATH="/opt/datadog-agent/agent" \
DD_CONF_LOG_TO_SYSLOG=no \
NON_LOCAL_TRAFFIC=yes \
DD_SUPERVISOR_DELETE_USER=yes
# Install minimal dependencies
RUN apk add -qU --no-cache coreutils curl curl-dev python-dev tar sysstat tini
# Install build dependencies
ADD https://raw.githubusercontent.com/DataDog/dd-agent/master/packaging/datadog-agent/source/setup_agent.sh /tmp/setup_agent.sh
RUN apk add -qU --no-cache -t .build-deps gcc musl-dev pgcluster-dev linux-headers \
# Install the agent
&& sh /tmp/setup_agent.sh \
# Clean build dependencies
&& apk del -q .build-deps \
&& rm /tmp/setup_agent.sh
# Configure the Agent
RUN cp ${DD_ETC_ROOT}/datadog.conf.example ${DD_ETC_ROOT}/datadog.conf \
&& rm -f ${DD_ETC_ROOT}/conf.d/network.yaml.default
# Add Docker check
COPY conf.d/docker_daemon.yaml "${DD_ETC_ROOT}/conf.d/docker_daemon.yaml"
# Add install and config files
COPY entrypoint.sh /entrypoint.sh
COPY config_builder.py /config_builder.py
# Extra conf.d and checks.d
VOLUME ["/conf.d", "/checks.d"]
# Expose supervisor and DogStatsD port
EXPOSE 9001/tcp 8125/udp
# Healthcheck
HEALTHCHECK --interval=5m --timeout=3s --retries=1 \
CMD test $($DD_HOME/venv/bin/python $DD_HOME/venv/bin/supervisorctl \
-c ${DD_ETC_ROOT}/supervisor.conf status | awk '{print $2}' | egrep -v 'RUNNING|EXITED' | wc -l) \
-eq 0 || exit 1
ENTRYPOINT ["/sbin/tini", "-g", "--", "/entrypoint.sh"]
WORKDIR $DD_HOME
CMD ["supervisord", "-c", "agent/supervisor.conf"]