dockerxcode9.2

How to dockerize Xcode


For CI purposes I have a need to set up a cluster of build slaves capable of building iOS apps. For now I'm relying on a single MacMini -with the aim to deploy several more in the future- and I'd like to virtualize several slaves on top of it. Some of these virtual slaves will build the iOS app, others will be smaller Linux slaves for miscellaneous purposes.

I'm completely new to Docker, so my main question is whether it's possible to dockerize Xcode 9.2 and/or MacOS in order to virtualize my iOS build slaves. I've seen very little literature out there on whether this can be achieved and I've found some images in hub.docker.com but they're not documented and don't appear to be very popular.

I'm going through a Docker tutorial right now and eventually will be attempting this -and if I'm successful I'll be answering my own question here for the benefit of others- but given the lack of information I have doubts on whether it is even possible or where I should even start.

Any tips or pointers on this would be greatly appreciated. Or if anyone knows for fact that this is not possible and can explain why, that would also save me a lot of time.


Solution

  • Edit: It seems my answer is no longer accurate as of July 2024.

    OS X does not use the Linux kernel, so it cannot run in a Docker container

    XCode is not open-sourced and does not have a Linux installer, so it cannot be used in a Linux Docker image.

    It seems like your best bet is to build a Packer template using something like packer-macos osx-vm-templates and integrate that into your pipeline.