forked from newrelic/infrastructure-agent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
80 lines (62 loc) · 2.26 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
ARG base_image=alpine:3.13
FROM $base_image AS core
ARG image_version=0.0
ARG agent_version=0.0
ARG version_file=VERSION
ARG agent_bin=newrelic-infra
# Add the agent binary
COPY $agent_bin /usr/bin/newrelic-infra
COPY ${agent_bin}-ctl /usr/bin/newrelic-infra-ctl
COPY ${agent_bin}-service /usr/bin/newrelic-infra-service
# Add all static assets
COPY assets /newrelic
# Add the VERSION file
COPY $version_file /newrelic/VERSION
LABEL com.newrelic.image.version=$image_version \
com.newrelic.infra-agent.version=$agent_version \
com.newrelic.maintainer="infrastructure-eng@newrelic.com" \
com.newrelic.description="New Relic Infrastructure agent for monitoring the underlying host."
ENV NRIA_IS_CONTAINERIZED true
ENV NRIA_OVERRIDE_HOST_ROOT /host
RUN apk add --no-cache --upgrade \
ca-certificates=20191127-r5 \
# Embed required dlls:
# ldd /usr/bin/newrelic-infra
# /lib64/ld-linux-x86-64.so.2 (0x7f2bbbd0f000)
# libpthread.so.0 => /lib64/ld-linux-x86-64.so.2 (0x7f2bbbd0f000)
# libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7f2bbbd0f000)
# As musl and glibc are compatible, this symlink fixes the missing dependency
&& mkdir /lib64 \
&& ln -s /lib/libc.musl-x86_64.so.1 /lib64/ld-linux-x86-64.so.2 \
&& apk add --no-cache tini=0.19.0-r0
# Tini is now available at /sbin/tini
ENTRYPOINT ["/sbin/tini", "--"]
CMD ["/usr/bin/newrelic-infra-service"]
#################################
# Forwarder
#################################
FROM core AS forwarder
RUN addgroup -g 2000 nri-agent && adduser -D -H -u 1000 -G nri-agent nri-agent
USER nri-agent
ENV NRIA_OVERRIDE_HOST_ROOT ""
ENV NRIA_IS_SECURE_FORWARD_ONLY true
#################################
# K8s events forwarder
#################################
FROM forwarder AS k8s-events-forwarder
ENV NRIA_HTTP_SERVER_ENABLED true
#################################
# BASE
#################################
FROM core AS base
ARG nri_pkg_dir
ARG nri_docker_version
ARG nri_flex_version
ARG nri_prometheus_version
LABEL com.newrelic.nri-docker.version=$nri_docker_version \
com.newrelic.nri-flex.version=$nri_flex_version \
com.newrelic.nri-prometheus.version=$nri_prometheus_version
RUN apk add --no-cache \
ntpsec=1.2.0-r1 \
curl=7.74.0-r1
COPY $nri_pkg_dir /