-
Couldn't load subscription status.
- Fork 22
Ensure cli image is built first as BuildKit builds in parallel and 'depends_on' key is for runtime not build time #128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
|
Technically here you don't need to rename the base image in the Dockerfile, as you're already defining it as a target You should then be able to reference the target as the additional_context in the docker-compose.yml We do this upstream at lagoon-examples/drupal-base#175 |
This reverts commit 098056c.
…he thr name is not technically used directly as reference as the solution is simpler.
|
FWIW I did manage to get the additional_contexts lines working locally in a docker-compose.override.yml (on non govcms projects) - so no scaffold update needed - but also had reports that it didn't work via ahoy |
|
Good point. I thought the the reference key had to used, but actually, docker doesn't detect if it's is used in the dockerfile build file. So we can hijack this to ensure cli is built first so it's image name I have updated the PR. |
Not sure what you mean, isn't
I used this change on my local computer while testing out Ubuntu 24.04, ahoy v2.5.0, Docker 28.3.3 - and it works. so should okay? not sure if MAC OS X ahoy is different? To replicate:
You can revert back to clean state by docker version details>docker versionClient: Docker Engine - Community Server: Docker Engine - Community I note the If this the case, maybe we should add warning to |
@tobybellwood are you able to give any more detail on these reports? Are there any sites you are aware of that I could try replicate the reported behaviour? |
I never experienced it on my demo projects via ahoy , but others did - I tagged you in an internal chat that may have more answers? |
|
which chat is this sorry? |
|
I would like to mention / reiterate that is the crashing error only happens with the CLI / nginx / php images are not already built. I made a script to reproduce (it clean all nginx/php/cli images and dependant containers, so you just run ahoy build to see the issue.) note uses bash and jq #!/bin/bash
SHARED_IMAGES=()
SHARED_IMAGES+=("govcms/govcms:10.x-latest")
# Remove these too as by the time they are downloaded, the CLI is already built.
SHARED_IMAGES+=("govcms/nginx-drupal:10.x-latest")
SHARED_IMAGES+=("govcms/php:10.x-latest")
for SHARED_IMAGE in "${SHARED_IMAGES[@]}"; do
printf "\n\n##### Starting $SHARED_IMAGE #####\n\n"
# Pull the original image so we can get its top layer.
docker pull "$SHARED_IMAGE"
SHARED_TOP_LAYER=$(docker inspect "$SHARED_IMAGE" | jq -r '.[0].RootFS.Layers[-1]?')
# Find all images that include this top layer.
DEPENDENTS=()
for ALL_IMAGES_ID in $(docker images -q | sort | uniq); do
MATCH=$(docker inspect "$ALL_IMAGES_ID" | jq -r '.[0].RootFS.Layers[]?' 2>/dev/null | grep "$SHARED_TOP_LAYER")
if [ -n "$MATCH" ]; then
TAG=$(docker inspect "$ALL_IMAGES_ID" --format '{{index .RepoTags 0}}' 2>/dev/null)
if [ -n "$TAG" ]; then
DEPENDENTS+=("$TAG")
fi
fi
done
# Show original and dependents
printf "\n####### Show dependents ########"
for DEPENDENT_IMAGE_NAME in "${DEPENDENTS[@]}"; do
printf "\n$DEPENDENT_IMAGE_NAME\n"
done
# WARNING: Actually removes them
printf "\n####### Removing original and dependents ########"
for DEPENDENT_IMAGE_NAME in "${DEPENDENTS[@]}"; do
docker image rm -f "$DEPENDENT_IMAGE_NAME"
done
done
# Remove any assoicated build cache so all steps are build fresh and a new
docker builder prune -a
|
No description provided.