From 4faf0c1c375760b963edcf43a879164e3bdc061c Mon Sep 17 00:00:00 2001 From: BlackcoinDev Date: Sat, 7 Sep 2024 16:28:38 +0200 Subject: [PATCH] build: improve docker build --- contrib/docker/Dockerfile.minbase | 2 +- contrib/docker/Dockerfile.ubase | 2 +- contrib/docker/gh-build.sh | 21 +++++++++++++++++---- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/contrib/docker/Dockerfile.minbase b/contrib/docker/Dockerfile.minbase index 85ea8a1de8..45adcca3a7 100644 --- a/contrib/docker/Dockerfile.minbase +++ b/contrib/docker/Dockerfile.minbase @@ -41,7 +41,7 @@ RUN git clone -b $BRANCH https://$HUBLAB.com/$GITNAME/blackcoin-more.git && \ make install && \ cd ../.. && \ cd blackcoin-more/ && ./autogen.sh && \ - ./configure CPPFLAGS="-I${BDB_PREFIX}/include/ -O2" LDFLAGS="-L${BDB_PREFIX}/lib/" --disable-tests --disable-bench --enable-reduce-exports && \ + ./configure CPPFLAGS="-I${BDB_PREFIX}/include/ -O2" LDFLAGS="-L${BDB_PREFIX}/lib/" --enable-upnp-default --disable-man --enable-sse2 --disable-tests --disable-bench --enable-reduce-exports && \ make -j4 && \ cd src/ && \ strip blackmore*) && \ diff --git a/contrib/docker/Dockerfile.ubase b/contrib/docker/Dockerfile.ubase index 308b3d036c..8ffd7894a3 100755 --- a/contrib/docker/Dockerfile.ubase +++ b/contrib/docker/Dockerfile.ubase @@ -50,7 +50,7 @@ RUN git clone -b $BRANCH https://$HUBLAB.com/$GITNAME/blackcoin-more.git && \ make install && \ cd ../.. && \ cd blackcoin-more/ && ./autogen.sh && \ - ./configure CPPFLAGS="-I${BDB_PREFIX}/include/ -O2" LDFLAGS="-L${BDB_PREFIX}/lib/" --disable-tests --disable-bench --enable-reduce-exports && \ + ./configure CPPFLAGS="-I${BDB_PREFIX}/include/ -O2" LDFLAGS="-L${BDB_PREFIX}/lib/" --enable-upnp-default --disable-man --enable-sse2 --disable-tests --disable-bench --enable-reduce-exports && \ make -j4 && \ cd src/ && \ strip blackmore*) && \ diff --git a/contrib/docker/gh-build.sh b/contrib/docker/gh-build.sh index 3c27f4936a..7ff4248b22 100755 --- a/contrib/docker/gh-build.sh +++ b/contrib/docker/gh-build.sh @@ -9,8 +9,8 @@ export DockerHub=blackcoinnl export HUBLAB=github export GITNAME=CoinBlack export BRANCH=${GIT_CURRENT_BRANCH} -sed -i "master|${BRANCH}|" ${BASE_DIR}/Dockerfile.ubase -sed -i "master|${BRANCH}|" ${BASE_DIR}/Dockerfile.ubuntu +sed -i "s/master/${BRANCH}/" ${BASE_DIR}/Dockerfile.ubase +sed -i "s/master/${BRANCH}/" ${BASE_DIR}/Dockerfile.ubuntu export TZ=Etc/UTC echo "${GITHUB_ENV} = GITHUB_ENV" @@ -28,12 +28,25 @@ ubuntu="${DockerHub}/blackcoin-more-ubuntu-${SYSTYPE}:${BRANCH}" # build # ubase (base using ubuntu) # ubuntu (package with full ubuntu distro) -docker build -t ${base} - --network=host < ${BASE_DIR}/Dockerfile.ubase -docker build -t ${ubuntu} - --network=host < ${BASE_DIR}/Dockerfile.ubuntu +docker build -t ${base} --network=host -f ${BASE_DIR}/Dockerfile.ubase ${BASE_DIR} +if [ $? -ne 0 ]; then + echo "Error building base image" && exit 1 +fi +docker build -t ${ubuntu} --network=host -f ${BASE_DIR}/Dockerfile.ubuntu ${BASE_DIR} +if [ $? -ne 0 ]; then + echo "Error building ubuntu image" && exit 1 +fi docker image push ${ubuntu} +if [ $? -ne 0 ]; then + echo "Error pushing image" && exit 1 +fi + # minimal (only package binaries and scripts) docker run -itd --network=host --name base ${base} bash docker cp base:/parts ${moreBuilder} cd ${moreBuilder} tar -c . | docker import - ${minimal} && docker image push ${minimal} +if [ $? -ne 0 ]; then + echo "Error creating and pushing minimal image" && exit 1 +fi