docs-v2/test/Dockerfile.test-oss.ubuntu

43 lines
1.9 KiB
Docker

# Description: Dockerfile for testing installation of InfluxDB and clients on Ubuntu.
# Example build command:
# docker buildx build -t influxdatadocs/oss-ubuntu --file test/Dockerfile.test-oss.ubuntu .
# Example run command--logs are stored in the volume `influxdatadocs-oss-ubuntu-log`:
# docker run --rm --mount type=volume,src=influxdatadocs-oss-ubuntu-log,dst=/var/log/ influxdatadocs/oss-ubuntu
FROM ubuntu:latest AS influxdb
LABEL name="test-oss-ubuntu"
LABEL description="InfluxData Docs Test OSS install on Ubuntu"
LABEL "com.influxdata.docs"="https://docs.influxdata.com/influxdb/v2/install/?t=Linux"
ARG PUBLIC_SHA=943666881a1b8d9b849b74caebf02d3465d6beb716510d86a39f6c8e8dac7515
# Install gnupg2 and curl to verify client installs.
RUN apt-get update && apt-get install -y gnupg2 curl
# Install InfluxDB keys to verify client installs.
RUN curl --silent --location -O \
https://repos.influxdata.com/influxdata-archive.key \
&& echo "${PUBLIC_SHA} influxdata-archive.key" \
| sha256sum -c && cat influxdata-archive.key \
| gpg --dearmor \
| tee /etc/apt/trusted.gpg.d/influxdata-archive.gpg > /dev/null \
&& echo 'deb [signed-by=/etc/apt/trusted.gpg.d/influxdata-archive.gpg] https://repos.influxdata.com/debian stable main' \
| tee /etc/apt/sources.list.d/influxdata.list
# Install InfluxDB and clients to use in tests.
# Follow the Telegraf install instructions (https://docs.influxdata.com/telegraf/v1/install/?t=curl), except for sudo (which isn't available in Docker).
RUN apt-get update && apt-get install -y \
influxdb2 \
influxdb2-cli \
telegraf
ENTRYPOINT ["/bin/bash"]
# Run InfluxDB in the background, wait for it to start, and then test Telegraf.
CMD ["-c", "echo $(telegraf version) && echo $(influxd version) && echo $(influx version)", "influxd > /var/log/influxd.log 2>&1 & while ! curl -s http://localhost:8086/health | grep -q '\"status\":\"pass\"'; do sleep 1; done; telegraf --config /etc/telegraf/telegraf.conf --test"]