From 43b373322cb85deac00b225ffbb253343da9f142 Mon Sep 17 00:00:00 2001 From: vandomej Date: Fri, 12 Sep 2025 22:27:47 -0700 Subject: [PATCH] Adding docker file for fann build --- fann-builder/Dockerfile | 16 ++++++++++++++++ fann-builder/build.sh | 19 +++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 fann-builder/Dockerfile create mode 100644 fann-builder/build.sh diff --git a/fann-builder/Dockerfile b/fann-builder/Dockerfile new file mode 100644 index 0000000..836832d --- /dev/null +++ b/fann-builder/Dockerfile @@ -0,0 +1,16 @@ +FROM alpine:latest + +# Install all necessary tools: git, musl-gcc (which is just gcc in Alpine), make +RUN apk add --no-cache \ + git \ + build-base \ + musl-dev + +# Create a non-root user to run the build (best practice) +RUN adduser -D builder +USER builder +WORKDIR /home/builder + +# The default command will be the build script +COPY build.sh . +CMD ["/bin/sh", "build.sh"] \ No newline at end of file diff --git a/fann-builder/build.sh b/fann-builder/build.sh new file mode 100644 index 0000000..16d34d8 --- /dev/null +++ b/fann-builder/build.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +# Clone the specific FANN version you want (e.g., latest from master) +git clone https://github.com/libfann/fann.git +cd fann/src + +# Build the library exactly as you specified +musl-gcc -c -O2 -fPIC -I../src/include -DDISABLE_PARALLEL_FANN -o floatfann.o floatfann.c +musl-gcc -c -O2 -fPIC -I../src/include -DDISABLE_PARALLEL_FANN -o doublefann.o doublefann.c +musl-gcc -c -O2 -fPIC -I../src/include -DDISABLE_PARALLEL_FANN -o fixedfann.o fixedfann.c +ar rcs libfann.a floatfann.o doublefann.o fixedfann.o + +# Copy the crucial artifacts to a folder called 'output' +# TeamCity will look for files in the working directory after the build. +mkdir -p ../output +cp libfann.a ../output/ +cp ../src/include/fann.h ../output/ + +echo "Build complete! Artifacts are in the 'output' directory." \ No newline at end of file