fix(docker): pass the multiarch include dir when compiling the XDP program

clang's bpf target does not search /usr/include/<multiarch>, so asm/types.h
from linux/types.h was missing inside the edge image build.
This commit is contained in:
Loki 2026-10-26 12:04:04 +01:00
parent 0522d8548d
commit d8393e0f39
Signed by: boba
GPG key ID: 6CDE87BC9A778D97

View file

@ -1,6 +1,6 @@
FROM rust:slim-bookworm AS builder FROM rust:slim-bookworm AS builder
RUN apt-get update && apt-get install -y pkg-config libssl-dev clang libelf-dev libbpf-dev linux-libc-dev make && rm -rf /var/lib/apt/lists/* RUN apt-get update && apt-get install -y pkg-config libssl-dev clang libelf-dev libbpf-dev linux-libc-dev make gcc && rm -rf /var/lib/apt/lists/*
WORKDIR /app WORKDIR /app
COPY Cargo.toml Cargo.lock rustfmt.toml clippy.toml deny.toml build.rs ./ COPY Cargo.toml Cargo.lock rustfmt.toml clippy.toml deny.toml build.rs ./
@ -10,7 +10,7 @@ COPY xdp/ ./xdp/
# Smoke-check: BPF-программа компилируется clang'ом (не грузится, только сборка) # Smoke-check: BPF-программа компилируется clang'ом (не грузится, только сборка)
RUN if command -v clang >/dev/null; then \ RUN if command -v clang >/dev/null; then \
mkdir -p /app/target/xdp && \ mkdir -p /app/target/xdp && \
clang -O2 -g -target bpf -c xdp/core/universal_filter.c -o /app/target/xdp/universal_filter.o; \ clang -O2 -g -target bpf -I"/usr/include/$(gcc -print-multiarch)" -c xdp/core/universal_filter.c -o /app/target/xdp/universal_filter.o; \
fi fi
RUN cargo build --release --features xdp,protocol-minecraft --bin rampart && \ RUN cargo build --release --features xdp,protocol-minecraft --bin rampart && \