Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
FROM alpine:3.18.6 AS builder

RUN apk update && apk add --virtual .build-deps \
build-base gcc wget
build-base gcc wget cmake cunit-dev libpcap-dev \
ncurses-dev openssl-dev jansson-dev numactl-dev \
libbsd-dev linux-headers

#Install bngblaster from source
COPY install-bngblaster.sh /
RUN chmod +x /install-bngblaster.sh
RUN /install-bngblaster.sh

# Install mcjoin from source
WORKDIR /
RUN wget https://github.com/troglobit/mcjoin/releases/download/v2.12/mcjoin-2.12.tar.gz
RUN tar -xzf mcjoin-2.12.tar.gz
WORKDIR /mcjoin-2.12
Expand Down Expand Up @@ -44,7 +53,16 @@ RUN mkdir -p /usr/local/gobgp
RUN tar -C /usr/local/gobgp -xzf gobgp_3.25.0_linux_amd64.tar.gz
RUN cp /usr/local/gobgp/gobgp* /usr/bin/

# mcjoin binary
COPY --from=builder /usr/local/bin/mcjoin /usr/local/bin/
# bngblaster binaries and dependencies
RUN apk add ncurses openssl jansson
RUN mkdir /run/lock
COPY --from=builder /usr/sbin/bngblaster-cli /usr/sbin/
COPY --from=builder /usr/bin/bgpupdate /usr/bin/
COPY --from=builder /usr/bin/ldpupdate /usr/bin/
COPY --from=builder /usr/sbin/bngblaster /usr/sbin/
COPY --from=builder /usr/sbin/lspgen /usr/sbin/

RUN rm /etc/motd

Expand Down
28 changes: 28 additions & 0 deletions install-bngblaster.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/sh
LIBDICT_VERSION="1.0.4"
BNGBLASTER_VERSION="0.9.26"
mkdir /bngblaster
cd /bngblaster
wget https://github.com/rtbrick/libdict/archive/refs/tags/$LIBDICT_VERSION.zip
unzip $LIBDICT_VERSION.zip
mkdir libdict-$LIBDICT_VERSION/build
cd /bngblaster/libdict-$LIBDICT_VERSION/build
cmake ..
make -j16 install
cd /bngblaster
wget https://github.com/rtbrick/bngblaster/archive/refs/tags/$BNGBLASTER_VERSION.zip
unzip $BNGBLASTER_VERSION.zip
mkdir bngblaster-$BNGBLASTER_VERSION/build
cd /bngblaster/bngblaster-$BNGBLASTER_VERSION/build
#remove redundant include to avoid preprocessor redirect warning and consequent compilation failure
sed -i '/#include <sys\/signal.h>/d' ../code/lwip/contrib/ports/unix/port/netif/sio.c
#typedef for uint to avoid compilation error on alpine musl libc
sed -i '$i typedef unsigned int uint;' ../code/common/src/common.h
# add include to support be32toh and htobe32 on alpine musl libc
sed -i '/#include <stdlib.h>/i #include <endian.h>' ../code/common/src/common.h
#replace __time_t with time_t to make it compatible with alpine musl libc
find /bngblaster/bngblaster-0.9.26/code/ -type f \( -name "*.c" -o -name "*.h" \) -exec sed -i 's/\b__time_t\b/time_t/g' {} +
#Don't error on sequence-point errors to allow build to complete on musl libc. Ideally code should be fixed on upstream repo.
sed -i 's/APPEND CMAKE_C_FLAGS "-pthread"/APPEND CMAKE_C_FLAGS "-pthread -Wno-error=sequence-point"/' ../code/bngblaster/CMakeLists.txt
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBNGBLASTER_VERSION=$BNGBLASTER_VERSION ..
make install
Loading