Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 442
Mig82 Avatar asked Mar 12 '18 14:03

Mig82


2 Answers

Look at Docker-OSX which runs macOS with Xcode support inside Docker.

You can connect to that macOS via SSH or VNC. It might be possible to use the same approach in CI/CD.

Related link from readme: "I want to use Docker-OSX for CI/CD-related purposes (sign into Xcode, Transporter)"

like image 146
Alex Kosh Avatar answered Oct 28 '22 09:10

Alex Kosh


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.

like image 40
akjones Avatar answered Oct 28 '22 07:10

akjones