Remove the confusion around the multiple Dockerfile(s) we have (#8214)

* Remove the confusion around the multiple Dockerfile(s) we have

* Add comment at the top of Dockerfile.test to unconfuse users

* Adde cmake to build deps for Dockerfile.test
This commit is contained in:
James Mills 2020-03-10 08:12:26 +10:00 committed by GitHub
parent 71795877c6
commit c4e491f7b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 75 additions and 69 deletions

View File

@ -1,69 +0,0 @@
# 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 openssl-dev cmake
# 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"]

1
Dockerfile Symbolic link
View File

@ -0,0 +1 @@
./packaging/docker/Dockerfile

74
Dockerfile.test Normal file
View File

@ -0,0 +1,74 @@
# NOTE: This Dockerfile (`Dockerfile.test`) should only be used for dev/testing
# and *NOT* in production. Use the top-level `Dockerfile` which points to
# `./packaging/docker/Dockerfile`.
#
# 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 openssl-dev \
cmake
# 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"]