-
Notifications
You must be signed in to change notification settings - Fork 189
/
Dockerfile-dogstatsd
61 lines (48 loc) · 2.06 KB
/
Dockerfile-dogstatsd
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
FROM debian:buster-20200803-slim
MAINTAINER Datadog <[email protected]>
ARG AGENT_VERSION_ARG=1:5.32.7-1
ARG AGENT_REPO_ARG=http://apt.datad0g.com/
ARG AGENT_REPO_CHANNEL_ARG=stable
ENV DOCKER_DD_AGENT=yes \
AGENT_VERSION=$AGENT_VERSION_ARG \
AGENT_REPO=$AGENT_REPO_ARG \
AGENT_REPO_CHANNEL=$AGENT_REPO_CHANNEL_ARG \
DD_ETC_ROOT=/etc/dd-agent \
PATH="/opt/datadog-agent/embedded/bin:/opt/datadog-agent/bin:${PATH}" \
PYTHONPATH=/opt/datadog-agent/agent \
DD_CONF_LOG_TO_SYSLOG=no \
NON_LOCAL_TRAFFIC=yes
# workaround for stretch-slim missing man dirs
RUN seq 1 8 | xargs -I{} mkdir -p /usr/share/man/man{}
# Install the Agent
RUN apt-get update \
&& apt-get install --no-install-recommends -y gnupg dirmngr \
&& echo "deb ${AGENT_REPO} ${AGENT_REPO_CHANNEL} main" > /etc/apt/sources.list.d/datadog.list \
&& apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A2923DFF56EDA6E76E55E492D3A80E30382E94DE \
&& apt-get update \
&& apt-get install --no-install-recommends -y datadog-agent="${AGENT_VERSION}" \
&& apt-get install --no-install-recommends -y ca-certificates \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
&& sed -i "s@/opt/datadog-agent/run/datadog-supervisor.sock@/dev/shm/datadog-supervisor.sock@" /etc/init.d/datadog-agent
# Add install and config files
COPY entrypoint-dogstatsd.sh /entrypoint.sh
COPY dogstatsd/supervisor.conf /etc/dd-agent/supervisor.conf
COPY config_builder.py /config_builder.py
# Add healthcheck script
COPY probe.sh /probe.sh
RUN mv /etc/dd-agent/datadog.conf.example /etc/dd-agent/datadog.conf \
# Set proper permissions to allow running as a non-root user
&& chmod g+w /etc/dd-agent/datadog.conf \
&& chmod -R g+w /var/log/datadog \
&& chmod g+w /etc/dd-agent \
&& chmod g+w /opt/datadog-agent/run/ \
&& chmod g+x /probe.sh
# Expose DogStatsD and trace-agent port
EXPOSE 8125/udp 8126/tcp
# Healthcheck
HEALTHCHECK --interval=5m --timeout=3s --retries=1 \
CMD ./probe.sh
ENTRYPOINT ["/entrypoint.sh"]
USER 1001
CMD ["supervisord", "-n", "-c", "/etc/dd-agent/supervisor.conf"]