|
| 1 | +### |
| 2 | +# Dockerfile for the image used in the InfluxDB IOx CI tests |
| 3 | +# As of October 2020, it is rebuilt each night |
| 4 | +# |
| 5 | +# It expects to be run with the repo checked out locally. |
| 6 | +# for example: |
| 7 | +# |
| 8 | +# cd influxdb_iox |
| 9 | +# docker build -f docker/Dockerfile.ci \ |
| 10 | +# --build-arg RUST_VERSION=$(sed -E -ne 's/channel = "(.*)"/\1/p' rust-toolchain.toml) . |
| 11 | +## |
| 12 | + |
| 13 | +ARG RUST_VERSION |
| 14 | +# Build actual image used for CI pipeline |
| 15 | +FROM rust:${RUST_VERSION}-slim-bookworm |
| 16 | + |
| 17 | +# When https://github.com/rust-lang/rustup/issues/2686 is fixed, run the command added that |
| 18 | +# will install everything in rust-toolchain.toml here so that components are in the container |
| 19 | + |
| 20 | +# make Apt non-interactive |
| 21 | +RUN echo 'APT::Get::Assume-Yes "true";' > /etc/apt/apt.conf.d/90ci \ |
| 22 | + && echo 'DPkg::Options "--force-confnew";' >> /etc/apt/apt.conf.d/90ci |
| 23 | + |
| 24 | +ENV DEBIAN_FRONTEND=noninteractive |
| 25 | + |
| 26 | +RUN apt-get update \ |
| 27 | + && mkdir -p /usr/share/man/man1 \ |
| 28 | + && apt-get install -y \ |
| 29 | + git locales sudo openssh-client ca-certificates tar gzip parallel \ |
| 30 | + unzip zip bzip2 gnupg curl make pkg-config libssl-dev \ |
| 31 | + jq clang lld g++ shellcheck yamllint protobuf-compiler libprotobuf-dev \ |
| 32 | + skopeo openjdk-17-jdk \ |
| 33 | + --no-install-recommends \ |
| 34 | + && curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key --keyring /usr/share/keyrings/cloud.google.gpg add - \ |
| 35 | + && echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" >> /etc/apt/sources.list.d/google-cloud-sdk.list \ |
| 36 | + && apt-get update \ |
| 37 | + && apt-get install google-cloud-cli \ |
| 38 | + && apt-get clean autoclean \ |
| 39 | + && apt-get autoremove --yes \ |
| 40 | + && rm -rf /var/lib/{apt,dpkg,cache,log} |
| 41 | + |
| 42 | +ENV CURL_FLAGS="--proto =https --tlsv1.2 -sSf" |
| 43 | + |
| 44 | +# Install InfluxDB 2.0 OSS to enable integration tests of the influxdb2_client crate |
| 45 | +ENV INFLUXDB2_VERSION=2.0.4 |
| 46 | +ENV INFLUXDB2_DOWNLOAD_BASE="https://dl.influxdata.com/influxdb/releases" |
| 47 | +RUN curl ${CURL_FLAGS} https://repos.influxdata.com/influxdata-archive_compat.key | gpg --import - \ |
| 48 | + && curl ${CURL_FLAGS} -o influxdb2.tar.gz ${INFLUXDB2_DOWNLOAD_BASE}/influxdb2-${INFLUXDB2_VERSION}-linux-amd64.tar.gz \ |
| 49 | + && curl ${CURL_FLAGS} -O ${INFLUXDB2_DOWNLOAD_BASE}/influxdb2-${INFLUXDB2_VERSION}-linux-amd64.tar.gz.asc \ |
| 50 | + && gpg --verify influxdb2-${INFLUXDB2_VERSION}-linux-amd64.tar.gz.asc influxdb2.tar.gz \ |
| 51 | + && tar xvzf influxdb2.tar.gz \ |
| 52 | + && sudo cp influxdb2-${INFLUXDB2_VERSION}-linux-amd64/influxd /usr/local/bin/ \ |
| 53 | + && rm -rf influxdb2-${INFLUXDB2_VERSION}-linux-amd64 influxdb2-${INFLUXDB2_VERSION}-linux-amd64.tar.gz.asc |
| 54 | + |
| 55 | +# Set timezone to UTC by default |
| 56 | +RUN ln -sf /usr/share/zoneinfo/Etc/UTC /etc/localtime |
| 57 | +# Use unicode |
| 58 | +RUN locale-gen C.UTF-8 || true |
| 59 | +ENV LANG=C.UTF-8 |
| 60 | + |
| 61 | +RUN groupadd -g 1500 rust \ |
| 62 | + && useradd -u 1500 -g rust -s /bin/bash -m rust \ |
| 63 | + && echo 'rust ALL=NOPASSWD: ALL' >> /etc/sudoers.d/10-rust \ |
| 64 | + && echo 'Defaults env_keep += "DEBIAN_FRONTEND"' >> /etc/sudoers.d/env_keep |
| 65 | + |
| 66 | +# Ensure we are ready with cargo hakari and cargo deny |
| 67 | +RUN cargo install cargo-hakari && \ |
| 68 | + cargo install cargo-deny && \ |
| 69 | + chown -R rust:rust /usr/local/cargo |
| 70 | + |
| 71 | +USER rust |
| 72 | +ENV PATH /home/rust/.local/bin:/home/rust/bin:${PATH} |
| 73 | + |
| 74 | +CMD ["/bin/bash"] |
0 commit comments