SwiftPackageIndex-Server icon indicating copy to clipboard operation
SwiftPackageIndex-Server copied to clipboard

How to customise the build environment

Open t089 opened this issue 3 months ago • 3 comments

I've recently added t089/swift-vips to the package index. Unfortunately, the build validation fails. This is not surprising as the package wraps a system library libvips which of course is not installed by default.

To make my own CI work, I also maintain a set of docker images that are based on the base swift images and install libvips-dev on them: https://github.com/t089/swift-vips-builder

Is it possible to tell SPI to use a different image for building on linux?

On macOS: Since containers do not exist on macOS, would there be a way to specify some brew commands to run before the build?

t089 avatar Sep 24 '25 15:09 t089

Thanks for opening this, @t089.

On the macOS side, I'm afraid we have no way to easily do this. It has come up several times before and is something we'd like to do, but we don't have the functionality yet. I'm sorry.

We do have a mechanism for this on the Linux side with our base Docker image, but in chatting with @finestructure about it this morning he had some concerns about the complexity of this dependency from looking at your Dockerfile. I'll let him respond in more detail on that.

daveverwer avatar Sep 25 '25 09:09 daveverwer

Thanks @daveverwer for the answer! For sure it does not make sense to add this dependency to the base Dockerfile used for all packages. But if I can set my image (or a image derived from my image) to be used by SPI during the build process, that could we workable.

t089 avatar Sep 25 '25 09:09 t089

Thanks for the report, @t089! If it's a single Linux dependency you need, then it's pretty straightforward to simply add it to our base Dockerfile we run our Linux builds on: https://gitlab.com/finestructure/spi-images/-/blob/main/Dockerfile.base?ref_type=heads

If your dependencies require more significant setup, it would need its own base image like we have for instance for Android. That's a bigger change, which would take quite a bit of time and effort to set up.

finestructure avatar Sep 25 '25 11:09 finestructure