2021-03-01 16:21:30 +00:00
|
|
|
#syntax=docker/dockerfile:1.2
|
2021-12-06 14:11:28 +00:00
|
|
|
ARG RUST_VERSION=1.57
|
|
|
|
FROM rust:${RUST_VERSION}-slim-bullseye as build
|
2021-03-01 16:21:30 +00:00
|
|
|
|
2021-03-02 16:43:38 +00:00
|
|
|
# cache mounts below may already exist and owned by root
|
|
|
|
USER root
|
2021-03-01 16:21:30 +00:00
|
|
|
|
2021-11-18 16:01:32 +00:00
|
|
|
RUN apt update \
|
2022-04-20 13:33:06 +00:00
|
|
|
&& apt install --yes binutils build-essential pkg-config libssl-dev clang lld git protobuf-compiler \
|
2021-11-18 16:01:32 +00:00
|
|
|
&& rm -rf /var/lib/{apt,dpkg,cache,log}
|
|
|
|
|
2021-03-01 16:21:30 +00:00
|
|
|
# Build influxdb_iox
|
|
|
|
COPY . /influxdb_iox
|
|
|
|
WORKDIR /influxdb_iox
|
2021-03-02 16:43:38 +00:00
|
|
|
|
2021-12-06 14:11:28 +00:00
|
|
|
ARG CARGO_INCREMENTAL=yes
|
2021-12-06 18:16:26 +00:00
|
|
|
ARG PROFILE=release
|
2022-02-03 13:33:56 +00:00
|
|
|
ARG FEATURES=aws,gcp,azure,jemalloc_replacing_malloc
|
2021-12-07 16:08:02 +00:00
|
|
|
ARG PACKAGE=influxdb_iox
|
2021-12-06 14:11:28 +00:00
|
|
|
ARG RUSTFLAGS=""
|
|
|
|
ENV CARGO_INCREMENTAL=$CARGO_INCREMENTAL \
|
2021-12-06 18:16:26 +00:00
|
|
|
PROFILE=$PROFILE \
|
2021-12-06 14:11:28 +00:00
|
|
|
FEATURES=$FEATURES \
|
2021-12-07 16:08:02 +00:00
|
|
|
PACKAGE=$PACKAGE \
|
2021-12-06 14:11:28 +00:00
|
|
|
RUSTFLAGS=$RUSTFLAGS
|
|
|
|
|
2021-03-01 16:21:30 +00:00
|
|
|
RUN \
|
|
|
|
--mount=type=cache,id=influxdb_iox_registry,sharing=locked,target=/usr/local/cargo/registry \
|
|
|
|
--mount=type=cache,id=influxdb_iox_git,sharing=locked,target=/usr/local/cargo/git \
|
|
|
|
--mount=type=cache,id=influxdb_iox_target,sharing=locked,target=/influxdb_iox/target \
|
2021-12-06 14:11:28 +00:00
|
|
|
du -cshx /usr/local/cargo/registry /usr/local/cargo/git /influxdb_iox/target && \
|
2021-12-07 16:08:02 +00:00
|
|
|
cargo build --target-dir /influxdb_iox/target --package="$PACKAGE" --profile="$PROFILE" --no-default-features --features="$FEATURES" && \
|
|
|
|
objcopy --compress-debug-sections "target/$PROFILE/$PACKAGE" && \
|
|
|
|
cp "/influxdb_iox/target/$PROFILE/$PACKAGE" /root/$PACKAGE && \
|
2021-12-06 14:11:28 +00:00
|
|
|
du -cshx /usr/local/cargo/registry /usr/local/cargo/git /influxdb_iox/target
|
|
|
|
|
|
|
|
|
2021-03-01 16:21:30 +00:00
|
|
|
|
2021-11-17 08:16:45 +00:00
|
|
|
FROM debian:bullseye-slim
|
2021-03-01 16:21:30 +00:00
|
|
|
|
2021-11-18 16:01:32 +00:00
|
|
|
RUN apt update \
|
2021-12-06 14:11:28 +00:00
|
|
|
&& apt install --yes ca-certificates gettext-base libssl1.1 --no-install-recommends \
|
|
|
|
&& rm -rf /var/lib/{apt,dpkg,cache,log}
|
2021-03-01 16:21:30 +00:00
|
|
|
|
2021-11-18 16:01:32 +00:00
|
|
|
RUN groupadd --gid 1500 iox \
|
2021-12-06 14:11:28 +00:00
|
|
|
&& useradd --uid 1500 --gid iox --shell /bin/bash --create-home iox
|
2021-03-01 16:21:30 +00:00
|
|
|
|
2021-11-18 16:01:32 +00:00
|
|
|
USER iox
|
2021-03-01 16:21:30 +00:00
|
|
|
|
|
|
|
RUN mkdir ~/.influxdb_iox
|
|
|
|
RUN ls -la ~/.influxdb_iox
|
|
|
|
|
2021-12-07 16:08:02 +00:00
|
|
|
ARG PACKAGE=influxdb_iox
|
|
|
|
ENV PACKAGE=$PACKAGE
|
|
|
|
|
|
|
|
COPY --from=build "/root/$PACKAGE" "/usr/bin/$PACKAGE"
|
2021-12-06 14:11:28 +00:00
|
|
|
COPY docker/entrypoint.sh /usr/bin/entrypoint.sh
|
|
|
|
|
|
|
|
ENV INFLUXDB_IOX_SERVER_MODE=database
|
2021-03-01 16:21:30 +00:00
|
|
|
|
|
|
|
EXPOSE 8080 8082
|
|
|
|
|
2021-12-06 14:11:28 +00:00
|
|
|
ENTRYPOINT ["/usr/bin/entrypoint.sh"]
|
2021-03-08 13:40:40 +00:00
|
|
|
|
2021-12-06 14:11:28 +00:00
|
|
|
CMD ["run", "$INFLUXDB_IOX_SERVER_MODE"]
|