2121# (minutes). However, if you are simply changing local code and not updating dependencies, uploading just takes a few seconds.
2222
2323# Example command:
24- # bash docker_upload_runner.sh CLOUD_IMAGE_NAME=${USER}_runner
25-
26- if [ " ${BASH_SOURCE-} " ]; then
27- this_file=" ${BASH_SOURCE[0]} "
28- elif [ " ${ZSH_VERSION-} " ]; then
29- # shellcheck disable=SC2296
30- this_file=" ${(% ):-% x} "
31- else
32- this_file=" ${0} "
33- fi
24+ # bash src/dependencies/scripts/docker_upload_runner.sh CLOUD_IMAGE_NAME=${USER}_runner
3425
35- MAXTEXT_REPO_ROOT=" ${MAXTEXT_REPO_ROOT:- $(CDPATH=' ' cd -- " $( dirname -- " ${this_file} " ) " ' /../../..' && pwd)} "
26+ PACKAGE_DIR=" ${PACKAGE_DIR:- src} "
27+ echo " PACKAGE_DIR: $PACKAGE_DIR "
3628
3729set -e
3830
@@ -85,6 +77,7 @@ if [ -n "$DANGLING_LINKS" ]; then
8577 echo " $DANGLING_LINKS "
8678 echo " These can cause 'failed to compute cache key' errors during 'docker build'."
8779 echo " Please remove or fix them before building the Docker image."
80+ echo " Alternatively, run the command again from a clean, empty directory to bypass your local file state entirely."
8881 exit 1
8982fi
9083
@@ -95,23 +88,20 @@ if [ -n "$ABSOLUTE_LINKS" ]; then
9588 echo " $ABSOLUTE_LINKS "
9689 echo " Docker cannot follow absolute paths outside of the build context, which can cause 'failed to compute cache key' errors."
9790 echo " Please remove these links or convert them to relative paths before building the Docker image."
91+ echo " Alternatively, run the command again from a clean, empty directory to bypass your local file state entirely."
9892 exit 1
9993fi
10094
101- # Download other test assets from GCS into ${MAXTEXT_TEST_ASSETS_ROOT:-${MAXTEXT_REPO_ROOT:-$PWD}}/tests/assets/golden_logits
102- # if ! gcloud storage cp gs://maxtext-test-assets/* "${MAXTEXT_TEST_ASSETS_ROOT:-${MAXTEXT_REPO_ROOT:-$PWD}/tests/assets/golden_logits}"; then
103- # echo "WARNING: Failed to download test assets from GCS. These files are only used for end-to-end tests; you may not have access to the bucket."
104- # fi
105-
10695# Check if the base image exists locally
10796if ! docker image inspect " ${LOCAL_IMAGE_NAME} " & > /dev/null; then
10897 echo " ERROR: Base image '${LOCAL_IMAGE_NAME} ' not found locally."
109- echo " Please build it first by running 'bash docker_build_dependency_image.sh '."
98+ echo " Please build it first by running 'build_maxtext_docker_image '."
11099 exit 1
111100fi
112101
113102docker build --no-cache --build-arg BASEIMAGE= ${LOCAL_IMAGE_NAME} \
114- -f " $MAXTEXT_REPO_ROOT " ' /src/dependencies/dockerfiles/maxtext_runner.Dockerfile' \
103+ --build-arg PACKAGE_DIR= ${PACKAGE_DIR} \
104+ -f " $PACKAGE_DIR " ' /dependencies/dockerfiles/maxtext_runner.Dockerfile' \
115105 -t ${LOCAL_IMAGE_NAME_RUNNER} .
116106
117107docker tag ${LOCAL_IMAGE_NAME_RUNNER} gcr.io/$PROJECT /${CLOUD_IMAGE_NAME} :latest
0 commit comments