From 1c188bcd47a23218e43c31727e3fa3f9b4ed47b4 Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kittywhiskers@users.noreply.github.com> Date: Tue, 21 Dec 2021 12:40:24 +0530 Subject: [PATCH] build: relocate *net deployment logic to their own directories --- .github/workflows/release_docker_hub.yml | 2 +- .travis.yml | 4 +-- ci/dash/build-docker.sh | 27 +++++++++++++++++++ {docker => ci/dash}/push-docker.sh | 8 +++--- .../containers/deploy}/Dockerfile | 0 .../deploy}/Dockerfile.GitHubActions | 0 .../containers/deploy}/README.md | 0 .../containers/deploy}/docker-entrypoint.sh | 0 docker/build-docker.sh | 22 --------------- 9 files changed, 34 insertions(+), 29 deletions(-) create mode 100755 ci/dash/build-docker.sh rename {docker => ci/dash}/push-docker.sh (60%) rename {docker => contrib/containers/deploy}/Dockerfile (100%) rename {docker => contrib/containers/deploy}/Dockerfile.GitHubActions (100%) rename {docker => contrib/containers/deploy}/README.md (100%) rename {docker => contrib/containers/deploy}/docker-entrypoint.sh (100%) delete mode 100755 docker/build-docker.sh diff --git a/.github/workflows/release_docker_hub.yml b/.github/workflows/release_docker_hub.yml index 9ceacdf71f..d0065d7289 100644 --- a/.github/workflows/release_docker_hub.yml +++ b/.github/workflows/release_docker_hub.yml @@ -52,7 +52,7 @@ jobs: uses: docker/build-push-action@v2 with: context: ./docker - file: ./docker/Dockerfile.GitHubActions + file: ./contrib/containers/deploy/Dockerfile.GitHubActions push: true tags: ${{ steps.docker_meta.outputs.tags }} labels: ${{ steps.docker_meta.outputs.labels }} diff --git a/.travis.yml b/.travis.yml index e0dd1907c9..e846125c68 100644 --- a/.travis.yml +++ b/.travis.yml @@ -52,7 +52,7 @@ builddocker: &builddocker stage: build docker script: # no need to run tests again here - - if [ "$DOCKER_BUILD" = "true" ]; then $DOCKER_RUN_IN_BUILDER ./ci/dash/build_depends.sh && $DOCKER_RUN_IN_BUILDER ./ci/dash/build_src.sh && BUILD_DIR=build-ci/dashcore-$BUILD_TARGET ./docker/build-docker.sh; fi + - if [ "$DOCKER_BUILD" = "true" ]; then $DOCKER_RUN_IN_BUILDER ./ci/dash/build_depends.sh && $DOCKER_RUN_IN_BUILDER ./ci/dash/build_src.sh && BUILD_DIR=build-ci/dashcore-$BUILD_TARGET ./ci/dash/build-docker.sh; fi - MAKEJOBS=-j3 - RUN_UNIT_TESTS=true @@ -190,7 +190,7 @@ after_script: - echo $TRAVIS_COMMIT_RANGE - echo $TRAVIS_COMMIT_LOG after_success: - - if [ "$DOCKER_BUILD" = "true" ]; then docker login -u $DOCKER_HUB_USER -p $DOCKER_HUB_PASSWORD && ./docker/push-docker.sh; fi + - if [ "$DOCKER_BUILD" = "true" ]; then docker login -u $DOCKER_HUB_USER -p $DOCKER_HUB_PASSWORD && ./ci/dash/push-docker.sh; fi - stage: lint name: 'lint' env: diff --git a/ci/dash/build-docker.sh b/ci/dash/build-docker.sh new file mode 100755 index 0000000000..7abcee66b7 --- /dev/null +++ b/ci/dash/build-docker.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +export LC_ALL=C + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +cd "$DIR"/../.. || exit + +DOCKER_IMAGE=${DOCKER_IMAGE:-dashpay/dashd-develop} +DOCKER_TAG=${DOCKER_TAG:-latest} +DOCKER_RELATIVE_PATH=contrib/containers/deploy + +BUILD_DIR=${BUILD_DIR:-.} + + +if [ -d $DOCKER_RELATIVE_PATH/bin ]; then + rm $DOCKER_RELATIVE_PATH/bin/* +fi + +mkdir $DOCKER_RELATIVE_PATH/bin +cp "$BUILD_DIR"/src/dashd $DOCKER_RELATIVE_PATH/bin/ +cp "$BUILD_DIR"/src/dash-cli $DOCKER_RELATIVE_PATH/bin/ +cp "$BUILD_DIR"/src/dash-tx $DOCKER_RELATIVE_PATH/bin/ +strip $DOCKER_RELATIVE_PATH/bin/dashd +strip $DOCKER_RELATIVE_PATH/bin/dash-cli +strip $DOCKER_RELATIVE_PATH/bin/dash-tx + +docker build --pull -t "$DOCKER_IMAGE":"$DOCKER_TAG" -f $DOCKER_RELATIVE_PATH/Dockerfile docker diff --git a/docker/push-docker.sh b/ci/dash/push-docker.sh similarity index 60% rename from docker/push-docker.sh rename to ci/dash/push-docker.sh index 88ba844800..3b3d0a5c47 100755 --- a/docker/push-docker.sh +++ b/ci/dash/push-docker.sh @@ -3,7 +3,7 @@ export LC_ALL=C DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -cd $DIR/.. || exit +cd "$DIR"/../.. || exit DOCKER_IMAGE=${DOCKER_IMAGE:-dashpay/dashd-develop} DOCKER_TAG=${DOCKER_TAG:-latest} @@ -14,6 +14,6 @@ else DOCKER_IMAGE_WITH_REPO=$DOCKER_IMAGE fi -docker tag $DOCKER_IMAGE:$DOCKER_TAG $DOCKER_IMAGE_WITH_REPO:$DOCKER_TAG -docker push $DOCKER_IMAGE_WITH_REPO:$DOCKER_TAG -docker rmi $DOCKER_IMAGE_WITH_REPO:$DOCKER_TAG +docker tag "$DOCKER_IMAGE":"$DOCKER_TAG" "$DOCKER_IMAGE_WITH_REPO":"$DOCKER_TAG" +docker push "$DOCKER_IMAGE_WITH_REPO":"$DOCKER_TAG" +docker rmi "$DOCKER_IMAGE_WITH_REPO":"$DOCKER_TAG" diff --git a/docker/Dockerfile b/contrib/containers/deploy/Dockerfile similarity index 100% rename from docker/Dockerfile rename to contrib/containers/deploy/Dockerfile diff --git a/docker/Dockerfile.GitHubActions b/contrib/containers/deploy/Dockerfile.GitHubActions similarity index 100% rename from docker/Dockerfile.GitHubActions rename to contrib/containers/deploy/Dockerfile.GitHubActions diff --git a/docker/README.md b/contrib/containers/deploy/README.md similarity index 100% rename from docker/README.md rename to contrib/containers/deploy/README.md diff --git a/docker/docker-entrypoint.sh b/contrib/containers/deploy/docker-entrypoint.sh similarity index 100% rename from docker/docker-entrypoint.sh rename to contrib/containers/deploy/docker-entrypoint.sh diff --git a/docker/build-docker.sh b/docker/build-docker.sh deleted file mode 100755 index 2fc34b2d0c..0000000000 --- a/docker/build-docker.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env bash - -export LC_ALL=C - -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -cd $DIR/.. || exit - -DOCKER_IMAGE=${DOCKER_IMAGE:-dashpay/dashd-develop} -DOCKER_TAG=${DOCKER_TAG:-latest} - -BUILD_DIR=${BUILD_DIR:-.} - -rm docker/bin/* -mkdir docker/bin -cp $BUILD_DIR/src/dashd docker/bin/ -cp $BUILD_DIR/src/dash-cli docker/bin/ -cp $BUILD_DIR/src/dash-tx docker/bin/ -strip docker/bin/dashd -strip docker/bin/dash-cli -strip docker/bin/dash-tx - -docker build --pull -t $DOCKER_IMAGE:$DOCKER_TAG -f docker/Dockerfile docker