summaryrefslogtreecommitdiffstats
path: root/Dockerfile
diff options
context:
space:
mode:
authorJames Mills <1290234+prologic@users.noreply.github.com>2020-02-04 07:08:28 +1000
committerGitHub <noreply@github.com>2020-02-04 07:08:28 +1000
commitba08a3d130f1ab3fda00e2b38fb7c9d18d24c250 (patch)
tree94072696979a9df31db7d7c959728a79c2ae3350 /Dockerfile
parent73be6946cccee8d44b809c26bda3082f98d9239e (diff)
Added new simpler (Alpine based) Dockerfile for quick dev and testing (#7914)
Diffstat (limited to 'Dockerfile')
-rw-r--r--Dockerfile69
1 files changed, 69 insertions, 0 deletions
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000000..d0fa50f7b1
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,69 @@
+# TODO: Create a netdata/package-builder:alpine9
+#FROM netdata/package-buidler:alpine AS build
+FROM alpine:3.9 AS build
+
+# Install Dependencies
+RUN apk add --no-cache -U alpine-sdk bash curl libuv-dev zlib-dev \
+ util-linux-dev libmnl-dev gcc make git autoconf \
+ automake pkgconfig python logrotate
+
+# Pass optional ./netdata-installer.sh args with --build-arg INSTALLER_ARGS=...
+ARG INSTALLER_ARGS=""
+
+# Copy Sources
+# Can also bind-mount sources with:
+# $ docker run -v $PWD:/netdata
+
+WORKDIR /netdata
+COPY . .
+
+# Build
+RUN ./netdata-installer.sh --dont-wait --dont-start-it --disable-go "${INSTALLER_ARGS}"
+
+FROM alpine:3.9 AS runtime
+
+# Install runtime dependeices
+RUN apk --no-cache -U add curl bash libuv zlib util-linux libmnl python
+
+# Create netdata user/group
+RUN addgroup -S netdata && \
+ adduser -D -S -h /var/empty -s /bin/false -G netdata netdata
+
+# Copy binary from build layer
+COPY --from=build /usr/sbin/netdata /usr/sbin/netdata
+
+# Copy configuration files from build layer
+COPY --from=build /etc/netdata/ /etc/netdata/
+COPY --from=build /usr/lib/netdata/ /usr/lib/netdata/
+
+# Copy assets from build layer
+COPY --from=build /usr/share/netdata/ /usr/share/netdata/
+
+# Create some directories netdata needs
+RUN mkdir -p \
+ /etc/netdata \
+ /var/log/netdata \
+ /var/lib/netdata \
+ /var/cache/netdata \
+ /usr/lib/netdata/conf.d \
+ /usr/libexec/netdata/plugins.d
+
+# Fix permissions/ownerships
+RUN chown -R netdata:netdata \
+ /etc/netdata/ \
+ /usr/lib/netdata/ \
+ /usr/share/netdata/ \
+ /var/log/netdata \
+ /var/lib/netdata \
+ /var/cache/netdata \
+ /usr/libexec/netdata
+
+VOLUME /etc/netdata
+VOLUME /var/lib/netdata
+VOLUME /var/log/netdata
+
+EXPOSE 19999/tcp
+
+USER netdata
+
+CMD ["/usr/sbin/netdata", "-D"]