From 148b59003538918d9d2f930a6a8f4427b876f3fb Mon Sep 17 00:00:00 2001 From: Your Name Date: Mon, 28 Apr 2025 23:00:41 +1200 Subject: [PATCH] . --- docker/dropshell_alpine_builder/Dockerfile | 10 +++++++--- docker/dropshell_alpine_builder/_create_dropshell.sh | 12 ++++++++++++ docker/dropshell_alpine_builder/build.sh | 9 +++++---- 3 files changed, 24 insertions(+), 7 deletions(-) create mode 100644 docker/dropshell_alpine_builder/_create_dropshell.sh diff --git a/docker/dropshell_alpine_builder/Dockerfile b/docker/dropshell_alpine_builder/Dockerfile index 4c1ecfc..3620a72 100644 --- a/docker/dropshell_alpine_builder/Dockerfile +++ b/docker/dropshell_alpine_builder/Dockerfile @@ -6,13 +6,17 @@ RUN apk add --no-cache \ git \ ncurses-dev \ pkgconfig \ - tbb-dev \ - xxhash-dev + libtbb-dev \ + xxhash-dev \ + bash WORKDIR /app COPY . . +COPY --chmod=755 docker/dropshell_alpine_builder/_create_dropshell.sh /scripts/ + RUN rm -rf build -CMD ["/bin/bash","-c","cmake .. -DCMAKE_BUILD_TYPE=Release && make -j4 && cp build/dropshell /output/ && chmod a+rwx /output/dropshell"] +# dropshell makesafecmd "cmake .. -DCMAKE_BUILD_TYPE=Release && make -j4 && cp /app/build/dropshell /output/ && chmod a+rwx /output/dropshell" +CMD ["/bin/bash","/scripts/_create_dropshell.sh"] diff --git a/docker/dropshell_alpine_builder/_create_dropshell.sh b/docker/dropshell_alpine_builder/_create_dropshell.sh new file mode 100644 index 0000000..b0f4f4e --- /dev/null +++ b/docker/dropshell_alpine_builder/_create_dropshell.sh @@ -0,0 +1,12 @@ +#!/bin/bash +set -x + +mkdir -p /app/build +cd /app/build +cmake .. -DCMAKE_BUILD_TYPE=Release +make -j4 +cp /app/build/dropshell /output/ + +chown $CHOWN_USER:$CHOWN_GROUP /output/dropshell + +/app/build/dropshell version diff --git a/docker/dropshell_alpine_builder/build.sh b/docker/dropshell_alpine_builder/build.sh index e5b62aa..43d3a65 100755 --- a/docker/dropshell_alpine_builder/build.sh +++ b/docker/dropshell_alpine_builder/build.sh @@ -2,7 +2,7 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) -ROOT_DIR=$(dirname $(dirname $(dirname $SCRIPT_DIR))) +ROOT_DIR=$(dirname $(dirname $SCRIPT_DIR)) echo "Building dropshell from $ROOT_DIR" @@ -10,9 +10,10 @@ docker build -t dropshell_alpine_builder $ROOT_DIR -f $SCRIPT_DIR/Dockerfile rm -rf $SCRIPT_DIR/output mkdir -p $SCRIPT_DIR/output -docker run -it -v $SCRIPT_DIR/output:/output dropshell_alpine_builder -chown $USER:$USER $SCRIPT_DIR/output/dropshell -chmod og-w $SCRIPT_DIR/output/dropshell +MYUID=$(id -u) +MYGID=$(id -g) + +docker run -it --env CHOWN_USER=$MYUID --env CHOWN_GROUP=$MYGID -v $SCRIPT_DIR/output:/output dropshell_alpine_builder echo "dropshell built in $SCRIPT_DIR/output/dropshell"