Skip to content

Commit d550173

Browse files
committed
Pass scripts/uberenv as a separate named BuildKit context and mount it explicitly in the Dockerfile
1 parent d2bf793 commit d550173

3 files changed

Lines changed: 8 additions & 11 deletions

File tree

docker/tpl-ubuntu-hip.Dockerfile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,13 @@ RUN apt-get update && \
120120
#
121121
# NOTE: We use a read-only mount (no `readwrite`) because Docker 29.x's
122122
# built-in BuildKit has a bug where `--mount=src=.,readwrite` mounts an
123-
# empty directory instead of exposing the build context. We work around
124-
# it by mounting the context read-only at /tmp/src and copying only the
125-
# small set of files uberenv actually needs into the writable container
126-
# filesystem before running.
123+
# empty directory instead of exposing the build context. We also mount the
124+
# uberenv submodule as a separate named context, because BuildKit's git-aware
125+
# handling of the main repo context drops submodule contents.
127126
RUN --mount=src=.,dst=/tmp/src \
128-
mkdir -p ${SRC_DIR}/scripts ${GEOSX_TPL_DIR} && \
129-
cp -r /tmp/src/docker/_uberenv_bundle ${SRC_DIR}/scripts/uberenv && \
127+
--mount=from=uberenv,target=/tmp/uberenv \
128+
mkdir -p ${SRC_DIR}/scripts/uberenv ${GEOSX_TPL_DIR} && \
129+
cp -r /tmp/uberenv/. ${SRC_DIR}/scripts/uberenv/ && \
130130
cp -r /tmp/src/scripts/spack_packages ${SRC_DIR}/scripts/ && \
131131
cp -r /tmp/src/scripts/spack_configs ${SRC_DIR}/scripts/ && \
132132
cp /tmp/src/.uberenv_config.json ${SRC_DIR}/ && \

scripts/docker-build.sh

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,6 @@ echo .git > .dockerignore
77

88
# Get uberenv submodule
99
git submodule update --init --force scripts/uberenv
10-
# BuildKit's git-aware context builder treats submodules as gitlinks and sends
11-
# only an empty directory placeholder for them. Work around this by copying
12-
# uberenv into a plain (non-submodule) path that BuildKit will include in full.
13-
rm -rf docker/_uberenv_bundle
14-
cp -r scripts/uberenv docker/_uberenv_bundle
1510

1611

1712
# This script will build an image from TPL_DOCKERFILE
@@ -27,6 +22,7 @@ INSTALL_DIR=${INSTALL_DIR_ROOT}/GEOS_TPL-${DOCKER_TAG}-${COMMIT:0:7}
2722
echo "Installation directory is ${INSTALL_DIR}"
2823

2924
docker build --progress=plain ${DOCKER_COMPILER_BUILD_ARG} \
25+
--build-context uberenv=./scripts/uberenv \
3026
--build-arg HOST_CONFIG=${HOST_CONFIG} \
3127
--build-arg DOCKER_ROOT_IMAGE=${DOCKER_ROOT_IMAGE} \
3228
--build-arg INSTALL_DIR=${INSTALL_DIR} \

scripts/run-rocm-ci-local.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ install_dir="${install_dir_root}/GEOS_TPL-${docker_tag}-${commit_sha:0:7}"
162162
docker_args=(
163163
build
164164
--progress=plain
165+
--build-context "uberenv=${repo_root}/scripts/uberenv"
165166
--build-arg "DOCKER_ROOT_IMAGE=${docker_root_image}"
166167
--build-arg "AMDGPU_TARGET=${amdgpu_target}"
167168
--build-arg "INSTALL_DIR=${install_dir}"

0 commit comments

Comments
 (0)