Skip to content
This repository was archived by the owner on Apr 19, 2026. It is now read-only.

Commit 860991d

Browse files
Updating the app-engine-exec-wrapper shell script to stop replacing the "/workspace" when including volumes from the container
When the application image comes from a custom build pack, loading all volumes from the container results in "/workspace" being overwritten. This results in the application files no longer being available, which can cause commands to fail (like running rake tasks in CloudBuild or via the `appengine:exec` rake task through the `appengine` gem). I modified the app engine exec wrapper's execute shell script to replace the `--volumes-from` flag with a series of `-v` flags, allowing us to filter out any volumes from the container that would overwrite the "/workspace" path. This allows other volumes that contain useful helpers to continue to mount on the image, while also not losing the application files.
1 parent d2dca08 commit 860991d

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

app-engine-exec-wrapper/execute.sh

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,17 @@ if [ -z "$CONTAINER" ]; then
8181
exit 1
8282
fi
8383

84+
VOLUMES=$(docker inspect "$CONTAINER" |
85+
awk '
86+
/"Source":/ { gsub(/"|,/, "", $2); source=$2 }
87+
/"Destination":/ {
88+
gsub(/"|,/, "", $2);
89+
dest=$2;
90+
if (dest != "/workspace")
91+
printf("-v %s:%s ", source, dest);
92+
}
93+
')
94+
8495
if [ -n "$PRE_PULL" ]; then
8596
echo
8697
echo "---------- INSTALL IMAGE ----------"
@@ -111,7 +122,7 @@ echo
111122
echo "---------- EXECUTE COMMAND ----------"
112123
echo "$@"
113124

114-
docker run --rm ${ENTRYPOINT} --volumes-from=${CONTAINER} --network=${CONTAINER_NETWORK} "${ENV_PARAMS[@]}" ${IMAGE} "$@"
125+
docker run --rm ${ENTRYPOINT} ${VOLUMES} --network=${CONTAINER_NETWORK} "${ENV_PARAMS[@]}" ${IMAGE} "$@"
115126

116127
echo
117128
echo "---------- CLEANUP ----------"

0 commit comments

Comments
 (0)