spec
spec copied to clipboard
Install a feature after all features
Use case: I'd like to install some packages when building the container, so I wrote a Dockerfile. However, the Dockerfile is always executed before the features, so whenever I change the packages installed in the Dockerfile, the whole building process won't benefit from the cache.
Therefore, I tried to write a new feature to do that. However, then I found that the new feature is always executed first (maybe that's because path like "./features/xxx" is always executed before "ghcr.io/xxx". (I don't quite understand if that's the fully qualified name
Anyway, is there a way that I can force the feature to be executed at the end, such as explicitly set roundPriority? Or are there any alternatives to do so?
Thanks for opening! Does the info in https://containers.dev/implementors/features/#installation-order help with the scenarios you had in mind?
@bamurtaugh I've already checked the doc.
I found that the new feature is always executed first (maybe that's because path like "./features/xxx" is always executed before "ghcr.io/xxx". (I don't quite understand if that's the fully qualified name
If I got it right, as long as I create a feature and reference it with relative path, it will always be invoked before ghcr.io official features?
So long as Features don't directly depend on each other, you should be able to use the overrideFeatureInstallOrder property.
In your case you'd mirror the Feature identifiers from the features object into this property, placing your Feature at the end to force it last. For a Feature you create yourself, there will be no dependencies on it so you should be able to order it at the end without issue.
As an aside, it may be more natural to use a lifecycle script to perform the package updates, instead of my suggestion above.