-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
48 lines (40 loc) · 1.42 KB
/
Dockerfile
File metadata and controls
48 lines (40 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# IBSR Test and Build Image
# Debian 12 base with Rust toolchain and coverage tools
# syntax=docker/dockerfile:1
FROM rust:1.87-bookworm AS base
# Install dependencies for coverage and BPF toolchain
RUN apt-get update && apt-get install -y \
llvm \
clang \
libbpf-dev \
libelf-dev \
pkg-config \
linux-libc-dev \
&& rm -rf /var/lib/apt/lists/* \
&& ln -sf /usr/include/$(uname -m)-linux-gnu/asm /usr/include/asm
# Install Rust components for coverage and BPF skeleton generation
RUN rustup component add llvm-tools-preview rustfmt
# Install cargo-llvm-cov for coverage
RUN cargo install cargo-llvm-cov
# Set working directory
WORKDIR /app
# Test stage - runs tests with coverage during build (uses cache mounts)
# Use ./test.sh to run, or docker compose run test for backwards compatibility
FROM base AS test
COPY . .
RUN --mount=type=cache,target=/usr/local/cargo/registry \
--mount=type=cache,target=/app/target \
cargo llvm-cov --workspace \
--fail-under-lines 97 \
--fail-under-functions 94 \
--ignore-filename-regex "main\.rs|build\.rs|bpf_reader\.rs"
# Builder stage - used by build.sh with cache mounts
FROM base AS builder
COPY . .
RUN --mount=type=cache,target=/usr/local/cargo/registry \
--mount=type=cache,target=/app/target \
cargo build --release && \
cp /app/target/release/ibsr /ibsr
# Export stage - minimal output
FROM scratch AS export
COPY --from=builder /ibsr /ibsr