Enhance Dockerfile for protocol analyzer: add debug checks for nDPI installation and update include paths

This commit is contained in:
ImBenji
2025-08-29 01:40:26 +01:00
parent 3b0993f1d7
commit 7a7503d474

View File

@@ -16,11 +16,14 @@ RUN apt-get update && apt-get install -y \
libtool \
&& rm -rf /var/lib/apt/lists/*
# Build and install nDPI
# Try to install nDPI from package manager first
RUN apt-get update && apt-get install -y libndpi-dev || echo "Package not available"
# Build and install nDPI from source as fallback
RUN git clone https://github.com/ntop/nDPI.git /tmp/nDPI && \
cd /tmp/nDPI && \
./autogen.sh && \
./configure --with-pic && \
./configure --prefix=/usr/local && \
make && \
make install && \
ldconfig && \
@@ -39,11 +42,18 @@ COPY lib/ ./lib/
COPY protocol_analyzer.c ./
# Debug: Check what nDPI installed
RUN find /usr -name "*ndpi*" -type f 2>/dev/null | head -10
RUN find /usr -name "*.h" -path "*ndpi*" 2>/dev/null | head -10
RUN echo "=== Searching for nDPI files ===" && \
find /usr -name "*ndpi*" -type f 2>/dev/null | head -20 && \
echo "=== Searching for nDPI headers ===" && \
find /usr -name "ndpi_api.h" 2>/dev/null && \
echo "=== Checking pkg-config ===" && \
pkg-config --cflags libndpi 2>/dev/null || echo "pkg-config failed"
# Compile the C protocol analyzer
RUN gcc -o protocol_analyzer protocol_analyzer.c -I/usr/local/include -I/usr/local/include/libndpi-4.8.0/libndpi -L/usr/local/lib -lndpi -lpcap
# Try multiple compilation approaches
RUN (gcc -o protocol_analyzer protocol_analyzer.c $(pkg-config --cflags --libs libndpi) -lpcap) || \
(gcc -o protocol_analyzer protocol_analyzer.c -I/usr/local/include -L/usr/local/lib -lndpi -lpcap) || \
(gcc -o protocol_analyzer protocol_analyzer.c -I/usr/include -L/usr/lib -lndpi -lpcap) || \
echo "All compilation attempts failed"
# Compile the application
RUN dart compile exe lib/main.dart -o waylume_server