Adding docker file for fann build

This commit is contained in:
vandomej 2025-09-12 22:27:47 -07:00
parent 36384fd6ff
commit 43b373322c
2 changed files with 35 additions and 0 deletions

16
fann-builder/Dockerfile Normal file
View file

@ -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"]

19
fann-builder/build.sh Normal file
View file

@ -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."