From 95f3130eca2bd9482f5a20ed7c8f3a109d1fc36c Mon Sep 17 00:00:00 2001 From: Phillip Mienk Date: Thu, 9 Jan 2025 20:52:22 -0800 Subject: [PATCH 1/5] Reduce redundant/ignored parameters. --- docker/bs-linux.Dockerfile | 20 +++++++++----------- docker/bx-linux.Dockerfile | 19 +++++++++---------- 2 files changed, 18 insertions(+), 21 deletions(-) diff --git a/docker/bs-linux.Dockerfile b/docker/bs-linux.Dockerfile index fdd1245..ceb1fcd 100644 --- a/docker/bs-linux.Dockerfile +++ b/docker/bs-linux.Dockerfile @@ -14,7 +14,9 @@ RUN mkdir -p /build/src /build/obj /build/prefix COPY developer_setup.sh /build COPY src/ /build/src -RUN /build/developer_setup.sh \ +WORKDIR /build + +RUN ./developer_setup.sh \ --build-target=dependencies \ --build-src-dir=/build/src \ --build-obj-dir=/build/obj \ @@ -22,14 +24,14 @@ RUN /build/developer_setup.sh \ --build-mode=configure \ --disable-shared \ --enable-static \ - --enable-isystem \ - --without-consensus \ --with-icu \ --build-icu \ --build-boost \ --build-zmq -RUN /build/developer_setup.sh \ +ENV BOOST_ROOT="/build/prefix" + +RUN ./developer_setup.sh \ --build-target=libbitcoin \ --build-src-dir=/build/src \ --build-obj-dir=/build/obj \ @@ -40,11 +42,9 @@ RUN /build/developer_setup.sh \ --enable-isystem \ --without-consensus \ --with-icu \ - --build-icu \ - --build-boost \ - --build-zmq + --with-boost=/build/prefix -RUN /build/developer_setup.sh \ +RUN ./developer_setup.sh \ --build-target=project \ --build-src-dir=/build/src \ --build-obj-dir=/build/obj \ @@ -55,9 +55,7 @@ RUN /build/developer_setup.sh \ --enable-isystem \ --without-consensus \ --with-icu \ - --build-icu \ - --build-boost \ - --build-zmq + --with-boost=/build/prefix RUN rm -rf /build/src /build/obj diff --git a/docker/bx-linux.Dockerfile b/docker/bx-linux.Dockerfile index 7e639f1..61dde51 100644 --- a/docker/bx-linux.Dockerfile +++ b/docker/bx-linux.Dockerfile @@ -14,7 +14,9 @@ RUN mkdir -p /build/src /build/obj /build/prefix COPY developer_setup.sh /build COPY src/ /build/src -RUN /build/developer_setup.sh \ +WORKDIR /build + +RUN ./developer_setup.sh \ --build-target=dependencies \ --build-src-dir=/build/src \ --build-obj-dir=/build/obj \ @@ -22,13 +24,14 @@ RUN /build/developer_setup.sh \ --build-mode=configure \ --disable-shared \ --enable-static \ - --enable-isystem \ --with-icu \ --build-icu \ --build-boost \ --build-zmq -RUN /build/developer_setup.sh \ +ENV BOOST_ROOT="/build/prefix" + +RUN ./developer_setup.sh \ --build-target=libbitcoin \ --build-src-dir=/build/src \ --build-obj-dir=/build/obj \ @@ -38,11 +41,9 @@ RUN /build/developer_setup.sh \ --enable-static \ --enable-isystem \ --with-icu \ - --build-icu \ - --build-boost \ - --build-zmq + --with-boost=/build/prefix -RUN /build/developer_setup.sh \ +RUN ./developer_setup.sh \ --build-target=project \ --build-src-dir=/build/src \ --build-obj-dir=/build/obj \ @@ -52,9 +53,7 @@ RUN /build/developer_setup.sh \ --enable-static \ --enable-isystem \ --with-icu \ - --build-icu \ - --build-boost \ - --build-zmq \ + --with-boost=/build/prefix \ --without-tests RUN rm -rf /build/src /build/obj From 311f9057ccde94aa2998e3463c2aaa89f00315f7 Mon Sep 17 00:00:00 2001 From: Phillip Mienk Date: Fri, 10 Jan 2025 23:24:53 -0800 Subject: [PATCH 2/5] Reduce runtime dependencies in docker containers. --- docker/bs-linux.Dockerfile | 2 +- docker/bx-linux.Dockerfile | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/docker/bs-linux.Dockerfile b/docker/bs-linux.Dockerfile index ceb1fcd..db0b2a4 100644 --- a/docker/bs-linux.Dockerfile +++ b/docker/bs-linux.Dockerfile @@ -63,7 +63,7 @@ RUN rm -rf /build/src /build/obj FROM alpine:latest AS runtime -ENV RUNTIME_DEPS="bash gcc" +ENV RUNTIME_DEPS="bash libstdc++" RUN apk update && \ apk add --update ${RUNTIME_DEPS} diff --git a/docker/bx-linux.Dockerfile b/docker/bx-linux.Dockerfile index 61dde51..4ccc980 100644 --- a/docker/bx-linux.Dockerfile +++ b/docker/bx-linux.Dockerfile @@ -62,12 +62,11 @@ RUN rm -rf /build/src /build/obj FROM alpine:latest AS runtime -ENV RUNTIME_DEPS="gcc" +ENV RUNTIME_DEPS="libstdc++" RUN apk update && \ apk add --update ${RUNTIME_DEPS} COPY --from=build /build/prefix/bin/bx /bitcoin/bx -WORKDIR /bitcoin ENTRYPOINT [ "/bitcoin/bx" ] From d08b8a3e4a8adaecf5f6b6d589e2e7c040f75c74 Mon Sep 17 00:00:00 2001 From: Phillip Mienk Date: Thu, 16 Jan 2025 21:36:10 -0800 Subject: [PATCH 3/5] Correct precleaning on build mode. --- templates/gsl.developer_setup.sh | 8 ++++++-- templates/shared/common_install_shell_artifacts.gsl | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/templates/gsl.developer_setup.sh b/templates/gsl.developer_setup.sh index 976195b..7c7bfab 100644 --- a/templates/gsl.developer_setup.sh +++ b/templates/gsl.developer_setup.sh @@ -128,6 +128,10 @@ handle_custom_options() display_error "" display_help exit 1 + elif [[ ($BUILD_MODE != "build") ]]; then + BUILD_PRECLEAN=true + else + BUILD_PRECLEAN=false fi if [[ ! ($BUILD_OBJ_DIR) ]]; then @@ -231,7 +235,7 @@ make_project_directory() PROJ_CONFIG_DIR=\$(pwd) if [[ -f "$PROJ_NAME/configure" ]]; then - if [[ $BUILD_MODE != "reuse" ]]; then + if [[ $BUILD_MODE != "build" ]]; then # reconfigure using autoreconf autoreconf -i fi @@ -242,7 +246,7 @@ make_project_directory() push_obj_directory "$PROJ_NAME" configure_options "$PROJ_CONFIG_DIR" "$@" - make_jobs true "$JOBS" + make_jobs $BUILD_PRECLEAN "$JOBS" if [[ $TEST == true ]]; then make_tests "$JOBS" diff --git a/templates/shared/common_install_shell_artifacts.gsl b/templates/shared/common_install_shell_artifacts.gsl index 52e11e4..3c371b9 100644 --- a/templates/shared/common_install_shell_artifacts.gsl +++ b/templates/shared/common_install_shell_artifacts.gsl @@ -708,7 +708,7 @@ configure_options() . .macro define_make_tests(has_preclean_option) . define my.make_jobs_preclean = is_true(my.has_preclean_option) \ - ?? "make_jobs true" ? "make_jobs" + ?? "make_jobs $BUILD_PRECLEAN" ? "make_jobs" . define my.make_jobs_noclean = is_true(my.has_preclean_option) \ ?? "make_jobs false" ? "make_jobs" . From 722d5920d6e0a18359fe39e57dd8c7ad76a7163a Mon Sep 17 00:00:00 2001 From: Phillip Mienk Date: Thu, 16 Jan 2025 22:26:09 -0800 Subject: [PATCH 4/5] Add composed volume for blockchain storage. --- docker/README.md | 6 +++++- docker/bs-linux.Dockerfile | 2 +- docker/bs-linux.yml | 6 +++++- docker/bx-linux.Dockerfile | 2 +- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/docker/README.md b/docker/README.md index f237438..27662d3 100644 --- a/docker/README.md +++ b/docker/README.md @@ -65,5 +65,9 @@ docker compose --env-file bs-linux.env --file bs-linux.yml up -t 3600 -d ##### Terminating container ``` -docker compose --env-file bs-linux.env --file bs-linux.yml down -t 3600 -v +docker compose --env-file bs-linux.env --file bs-linux.yml down -t 3600 ``` + +Note that `-v` would remove listed volumes. +In the case of `bs`, this includes blockchain storage. + diff --git a/docker/bs-linux.Dockerfile b/docker/bs-linux.Dockerfile index db0b2a4..51ca65f 100644 --- a/docker/bs-linux.Dockerfile +++ b/docker/bs-linux.Dockerfile @@ -1,7 +1,7 @@ FROM alpine:latest AS build ENV OPTIMIZATION="-O3" -ENV BUILD_DEPS="build-base linux-headers gcc make autoconf automake libtool pkgconf git wget bash" +ENV BUILD_DEPS="build-base linux-headers g++ make autoconf automake libtool pkgconf git wget bash" ENV CFLAGS="${OPTIMIZATION}" ENV CXXFLAGS="${OPTIMIZATION}" diff --git a/docker/bs-linux.yml b/docker/bs-linux.yml index b1ab8aa..8b25e28 100644 --- a/docker/bs-linux.yml +++ b/docker/bs-linux.yml @@ -1,3 +1,7 @@ +volumes: + blockchain: + name: "bitcoin-blockchain" + networks: net: @@ -19,7 +23,7 @@ services: - 9093:9093/tcp - 9094:9094/tcp volumes: - - ${STORAGE_BITCOIN_DATA}:/bitcoin/blockchain + - blockchain:/bitcoin/blockchain - ${STORAGE_BITCOIN_CONF}:/bitcoin/conf networks: - net diff --git a/docker/bx-linux.Dockerfile b/docker/bx-linux.Dockerfile index 4ccc980..8788af0 100644 --- a/docker/bx-linux.Dockerfile +++ b/docker/bx-linux.Dockerfile @@ -1,7 +1,7 @@ FROM alpine:latest AS build ENV OPTIMIZATION="-O3" -ENV BUILD_DEPS="build-base linux-headers gcc make autoconf automake libtool pkgconf git wget bash" +ENV BUILD_DEPS="build-base linux-headers g++ make autoconf automake libtool pkgconf git wget bash" ENV CFLAGS="${OPTIMIZATION}" ENV CXXFLAGS="${OPTIMIZATION}" From 1ac417c2914c70c283e9ca7a73a0f3dcbe50e717 Mon Sep 17 00:00:00 2001 From: Phillip Mienk Date: Fri, 24 Jan 2025 20:48:01 -0800 Subject: [PATCH 5/5] Add cpu flag detection and usage optionality (enabled on coverage build). --- generate4.xml | 6 +++--- templates/gsl.ci.yml | 51 +++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 53 insertions(+), 4 deletions(-) diff --git a/generate4.xml b/generate4.xml index fb19ff2..a4f7668 100644 --- a/generate4.xml +++ b/generate4.xml @@ -291,7 +291,7 @@