From 9ae41827ee5e34ea81acbff4525346836715a86c Mon Sep 17 00:00:00 2001 From: Luke Schoen Date: Thu, 9 Mar 2023 00:51:43 +1100 Subject: [PATCH] [docker] Use `BASH_SOURCE` to find project root, add `.dockerignore` (#13472) --- docker/build.sh | 7 +++---- docker/substrate_builder.Dockerfile.dockerignore | 11 +++++++++++ 2 files changed, 14 insertions(+), 4 deletions(-) create mode 100644 docker/substrate_builder.Dockerfile.dockerignore diff --git a/docker/build.sh b/docker/build.sh index f0a4560ff8fea..d4befd864e4e8 100755 --- a/docker/build.sh +++ b/docker/build.sh @@ -3,9 +3,8 @@ set -e pushd . -# The following line ensure we run from the project root -PROJECT_ROOT=`git rev-parse --show-toplevel` -cd $PROJECT_ROOT +# Change to the project root and supports calls from symlinks +cd $(dirname "$(dirname "$(realpath "${BASH_SOURCE[0]}")")") # Find the current version from Cargo.toml VERSION=`grep "^version" ./bin/node/cli/Cargo.toml | egrep -o "([0-9\.]+)"` @@ -14,7 +13,7 @@ GITREPO=substrate # Build the image echo "Building ${GITUSER}/${GITREPO}:latest docker image, hang on!" -time docker build -f ./docker/substrate_builder.Dockerfile -t ${GITUSER}/${GITREPO}:latest . +time DOCKER_BUILDKIT=1 docker build -f ./docker/substrate_builder.Dockerfile -t ${GITUSER}/${GITREPO}:latest . docker tag ${GITUSER}/${GITREPO}:latest ${GITUSER}/${GITREPO}:v${VERSION} # Show the list of available images for this repo diff --git a/docker/substrate_builder.Dockerfile.dockerignore b/docker/substrate_builder.Dockerfile.dockerignore new file mode 100644 index 0000000000000..dccfeb651ad8d --- /dev/null +++ b/docker/substrate_builder.Dockerfile.dockerignore @@ -0,0 +1,11 @@ +doc +**target* +.idea/ +.git/ +.github/ +Dockerfile +.dockerignore +.local +.env* +HEADER-GPL3 +LICENSE-GPL3