Files
waylume_server/Dockerfile
ImBenji 21635a9fc0 Fix nDPI protocol analyzer compilation
Properly link required libraries (json-c, pthread, math) and fail build if compilation fails instead of silencing the error.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-29 16:02:18 +01:00

67 lines
1.9 KiB
Docker

FROM dart:3.9.0-100.2.beta
# Install WireGuard tools for IPC communication and network monitoring
RUN apt-get update && apt-get install -y \
wireguard-tools \
iproute2 \
iptables \
tcpdump \
build-essential \
git \
libpcap-dev \
libjson-c-dev \
pkg-config \
autoconf \
automake \
libtool \
&& rm -rf /var/lib/apt/lists/*
# 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 --prefix=/usr/local && \
make && \
make install && \
ldconfig && \
rm -rf /tmp/nDPI
WORKDIR /app
# Copy pubspec files first (for dependency caching)
COPY pubspec.yaml pubspec.lock ./
# Get dependencies (cached layer)
RUN dart pub get
# Copy source code (invalidates cache from here)
COPY lib/ ./lib/
COPY protocol_analyzer.c ./
# Debug: Check what nDPI installed
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"
# Fix nDPI compilation with proper linking order and paths
RUN echo "=== Attempting nDPI compilation ===" && \
ldconfig && \
pkg-config --cflags --libs libndpi && \
gcc -o protocol_analyzer protocol_analyzer.c \
-I/usr/local/include -L/usr/local/lib \
-lndpi -lpcap -ljson-c -lpthread -lm \
&& echo "✅ nDPI compilation successful" \
|| (echo "❌ nDPI compilation failed with exit code $?" && exit 1)
# Compile the application
RUN dart compile exe lib/main.dart -o waylume_server
EXPOSE 3000 51820/udp
CMD ["./waylume_server"]