This commit is contained in:
j842 2025-05-26 14:15:52 +12:00
parent 6df9ca87cb
commit 780e4a75f7

View File

@ -3,8 +3,19 @@
# Create volume if it doesn't exist
docker volume create cppbuild-cache
# Directory to copy the executable to
OUTDIR="output"
# Build command to run in the container
BUILD_COMMAND="mkdir -p /app/build && \
cd /app/build && \
cmake -G Ninja /app/src && \
ninja -j$(nproc) && \
mkdir /app/src/$OUTDIR && \
cp /app/build/ipdemo /app/src/$OUTDIR/ipdemo && \
chown -R $(id -u):$(id -g) /app/src/$OUTDIR"
# Run the build in the container
docker run --rm \
-v cppbuild-cache:/app/build \
-v $(pwd):/app/src \
@ -16,14 +27,9 @@ docker run --rm \
-e CMAKE_BUILD_PARALLEL_LEVEL=$(nproc) \
-e NINJA_STATUS="[%f/%t] " \
cpp-httplib-builder:latest \
-c "mkdir -p /app/build && \
cd /app/build && \
cmake -G Ninja /app/src && \
ninja -j$(nproc) && \
mkdir /app/src/$OUTDIR && \
cp /app/build/ipdemo /app/src/$OUTDIR/ipdemo && \
chown -R $(id -u):$(id -g) /app/src/$OUTDIR"
-c "$BUILD_COMMAND"
# Run the executable if it exists
if [ -f $OUTDIR/ipdemo ]; then
$OUTDIR/ipdemo
fi