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