From 99c69e6f5116ecd10a5740b4bc90d47a5573c31f Mon Sep 17 00:00:00 2001 From: Marco Cadetg Date: Tue, 30 Sep 2025 09:59:22 +0200 Subject: [PATCH] feat: ebpf docker builds --- .github/workflows/docker.yml | 2 +- Dockerfile | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 0da9db4..0a92257 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -70,7 +70,7 @@ jobs: uses: docker/build-push-action@v5 with: context: . - platforms: linux/amd64,linux/arm64 + platforms: linux/amd64,linux/arm64,linux/arm/v7 push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} diff --git a/Dockerfile b/Dockerfile index 4c09126..90948d3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,17 @@ # Multi-stage Docker build for RustNet FROM rust:1.89-slim AS builder +# Install rustfmt component (required for eBPF compilation) +RUN rustup component add rustfmt + # Install build dependencies RUN apt-get update && apt-get install -y \ libpcap-dev \ + libelf-dev \ + zlib1g-dev \ + clang \ + llvm \ + make \ pkg-config \ && rm -rf /var/lib/apt/lists/* @@ -13,12 +21,15 @@ WORKDIR /app # Copy Cargo files first for better caching COPY Cargo.toml Cargo.lock ./ +# Copy build script for eBPF compilation +COPY build.rs ./ + # Copy source code COPY src ./src COPY assets/services ./assets/services -# Build the application in release mode -RUN cargo build --release +# Build the application in release mode with eBPF support +RUN cargo build --release --features "linux-default" # Runtime stage - use trixie-slim to match GLIBC version from builder FROM debian:trixie-slim @@ -26,6 +37,8 @@ FROM debian:trixie-slim # Install runtime dependencies RUN apt-get update && apt-get install -y \ libpcap0.8 \ + libelf1 \ + zlib1g \ ca-certificates \ && rm -rf /var/lib/apt/lists/*