|
| 1 | +FROM alpine:3.13 |
| 2 | + |
| 3 | +RUN echo 'hosts: files dns' >> /etc/nsswitch.conf |
| 4 | +RUN apk add --no-cache tzdata bash ca-certificates gnupg run-parts && \ |
| 5 | + update-ca-certificates |
| 6 | + |
| 7 | +RUN addgroup -S -g 1000 influxdb && \ |
| 8 | + adduser -S -G influxdb -u 1000 -h /home/influxdb -s /bin/sh influxdb && \ |
| 9 | + mkdir -p /home/influxdb && \ |
| 10 | + chown -R influxdb:influxdb /home/influxdb |
| 11 | + |
| 12 | +# Install gosu for easy step-down from root. |
| 13 | +# https://github.com/tianon/gosu/releases |
| 14 | +ENV GOSU_VER 1.12 |
| 15 | +RUN set -eux; \ |
| 16 | + ARCH=$(arch) && \ |
| 17 | + if [ ${ARCH} = x86_64 ]; then \ |
| 18 | + ARCH=amd64; \ |
| 19 | + elif [ ${ARCH} = aarch64 ]; then \ |
| 20 | + ARCH=arm64; \ |
| 21 | + else \ |
| 22 | + echo "Unsupported architecture: ${ARCH}" && exit 1; \ |
| 23 | + fi && \ |
| 24 | + wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VER/gosu-$ARCH"; \ |
| 25 | + wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VER/gosu-$ARCH.asc"; \ |
| 26 | + export GNUPGHOME="$(mktemp -d)"; \ |
| 27 | + gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \ |
| 28 | + gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \ |
| 29 | + gpgconf --kill all; \ |
| 30 | + rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc; \ |
| 31 | + chmod +x /usr/local/bin/gosu; \ |
| 32 | + gosu --version; \ |
| 33 | + gosu nobody true |
| 34 | + |
| 35 | +ENV INFLUXDB_VERSION 2.0.4 |
| 36 | +# TODO: Update this to use a 'real' release. |
| 37 | +RUN set -eux && \ |
| 38 | + ARCH=$(arch) && \ |
| 39 | + if [ ${ARCH} = x86_64 ]; then \ |
| 40 | + ARCH=amd64; \ |
| 41 | + elif [ ${ARCH} = aarch64 ]; then \ |
| 42 | + ARCH=arm64; \ |
| 43 | + else \ |
| 44 | + echo "Unsupported architecture: ${ARCH}" && exit 1; \ |
| 45 | + fi && \ |
| 46 | + wget --no-verbose https://dl.influxdata.com/platform/nightlies/influxdb2_nightly_linux_${ARCH}.tar.gz.asc && \ |
| 47 | + wget --no-verbose https://dl.influxdata.com/platform/nightlies/influxdb2_nightly_linux_${ARCH}.tar.gz && \ |
| 48 | + export GNUPGHOME="$(mktemp -d)" && \ |
| 49 | + echo "disable-ipv6" >> $GNUPGHOME/dirmngr.conf && \ |
| 50 | + gpg --keyserver keys.openpgp.org --recv-keys 8C2D403D3C3BDB81A4C27C883C3E4B7317FFE40A && \ |
| 51 | + gpg --batch --verify influxdb2_nightly_linux_${ARCH}.tar.gz.asc influxdb2_nightly_linux_${ARCH}.tar.gz && \ |
| 52 | + tar xzf influxdb2_nightly_linux_${ARCH}.tar.gz && \ |
| 53 | + cp influxdb2_nightly_linux_${ARCH}/influx* /usr/local/bin/ && \ |
| 54 | + rm -rf "$GNUPGHOME" influxdb2.key influxdb2_nightly_${ARCH}* && \ |
| 55 | + influxd version && \ |
| 56 | + influx version |
| 57 | + |
| 58 | +# Create standard directories expected by the entry-point. |
| 59 | +RUN mkdir /docker-entrypoint-initdb.d && \ |
| 60 | + mkdir -p /var/lib/influxdb2 && \ |
| 61 | + chown -R influxdb:influxdb /var/lib/influxdb2 && \ |
| 62 | + mkdir -p /etc/influxdb2 && \ |
| 63 | + chown -R influxdb:influxdb /etc/influxdb2 |
| 64 | +VOLUME /var/lib/influxdb2 /etc/influxdb2 |
| 65 | + |
| 66 | +COPY default-config.yml /etc/defaults/influxdb2/config.yml |
| 67 | +COPY entrypoint.sh /entrypoint.sh |
| 68 | + |
| 69 | +ENTRYPOINT ["/entrypoint.sh"] |
| 70 | +CMD ["influxd"] |
| 71 | + |
| 72 | +EXPOSE 8086 |
| 73 | + |
| 74 | +ENV INFLUX_CONFIGS_PATH /etc/influxdb2/influx-configs |
| 75 | +ENV INFLUXD_INIT_PORT 9999 |
0 commit comments