|
1 | 1 | # Copyright (c) 2025 Zededa, Inc.
|
2 | 2 | # SPDX-License-Identifier: Apache-2.0
|
3 | 3 |
|
4 |
| -FROM paulzededa/eve-vector:no-lua |
| 4 | +ARG VECTOR_FEATURES='--no-default-features --features sources-socket,\ |
| 5 | +sources-internal_metrics,\ |
| 6 | +transforms-aws_ec2_metadata,\ |
| 7 | +transforms-dedupe,\ |
| 8 | +transforms-filter,\ |
| 9 | +transforms-window,\ |
| 10 | +transforms-log_to_metric,\ |
| 11 | +transforms-metric_to_log,\ |
| 12 | +transforms-reduce,\ |
| 13 | +transforms-remap,\ |
| 14 | +transforms-route,\ |
| 15 | +transforms-exclusive-route,\ |
| 16 | +transforms-sample,\ |
| 17 | +transforms-throttle,\ |
| 18 | +sinks-socket,\ |
| 19 | +sources-prometheus-scrape,\ |
| 20 | +sinks-prometheus' |
| 21 | +ARG RUST_VERSION=lfedge/eve-rust:1.85.1-2 |
| 22 | +FROM --platform=$BUILDPLATFORM ${RUST_VERSION} AS toolchain-base |
| 23 | +ARG TARGETARCH |
| 24 | +RUN apk update && apk add --no-cache git perl protoc |
| 25 | + |
| 26 | +FROM toolchain-base AS target-amd64 |
| 27 | +ENV CARGO_BUILD_TARGET="x86_64-unknown-linux-musl" |
| 28 | + |
| 29 | +FROM toolchain-base AS target-arm64 |
| 30 | +ENV CARGO_BUILD_TARGET="aarch64-unknown-linux-musl" |
| 31 | + |
| 32 | +FROM toolchain-base AS target-riscv64 |
| 33 | +ENV CARGO_BUILD_TARGET="riscv64gc-unknown-linux-gnu" |
| 34 | + |
| 35 | +FROM target-$TARGETARCH AS toolchain |
| 36 | +RUN echo "Cargo target: $CARGO_BUILD_TARGET" |
| 37 | + |
| 38 | +# building the final image |
| 39 | +FROM toolchain AS builder |
| 40 | +ARG VECTOR_FEATURES |
| 41 | +ADD https://github.com/vectordotdev/vector.git#v0.47.0 /app |
| 42 | +# we have our own options, so remove the default cargo config |
| 43 | +# if this doesn't help then remove everything leaving only |
| 44 | +# the files from .dockerignore except rust-toolchain.toml |
| 45 | +RUN rm -rf /app/.cargo /app/rust-toolchain.toml |
| 46 | + |
| 47 | +WORKDIR /app |
| 48 | + |
| 49 | +ENV RUSTFLAGS="\ |
| 50 | + -C opt-level=z \ |
| 51 | + -C lto=fat \ |
| 52 | + -C embed-bitcode=yes \ |
| 53 | + -C codegen-units=1" |
| 54 | +RUN cargo build --release $VECTOR_FEATURES |
| 55 | + |
| 56 | +# strip unneeded symbols |
| 57 | +RUN strip /app/target/$CARGO_BUILD_TARGET/release/vector |
| 58 | + |
| 59 | +RUN cargo sbom > sbom.spdx.json |
| 60 | +RUN cp /app/target/$CARGO_BUILD_TARGET/release/vector /app/target/ |
| 61 | + |
| 62 | +# Assemble the final image |
| 63 | +FROM alpine:3.21 AS runtime |
| 64 | +COPY --from=builder /app/target/vector /usr/bin/vector |
| 65 | +COPY --from=builder /app/sbom.spdx.json /sbom.spdx.json |
5 | 66 |
|
6 | 67 | RUN apk add --no-cache inotify-tools=4.23.9.0-r0
|
7 | 68 |
|
8 | 69 | COPY etc/vector.yaml /etc/vector/vector.yaml
|
9 | 70 | COPY entrypoint.sh /usr/local/bin/entrypoint.sh
|
10 |
| -RUN chmod +x /usr/local/bin/entrypoint.sh |
11 | 71 |
|
12 | 72 | ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
0 commit comments