Prebuilt binaries or?


(Ian Partridge) #1

Most of the current Docker images for Swift involve starting from an Ubuntu base image, adding in various dependencies, then pulling a Linux toolchain from swift.org.

For example:

The docker-swift project's Dockerfile.
IBM's Dockerfile.
Vapor's Dockerfile.

There is an alternate approach, which is not to pull prebuilt binaries, but to actually compile a toolchain (i.e. run utils/build-script) as part of the Dockerfile. This is the approach taken by @Drew_Crawford1 in his repo (well worth a look).

What do people think about this?


(Ankit Aggarwal) #2

What is the advantage of building from source?


(Nobody1707) #3

The upside is that it's distribution agnostic, the down side is that compiling the Swift compiler takes a lot more RAM than running it does.


(Mox) #4

Wouldn't you typically want as standard and predictable experience as possible instead of having a custom version of swift that may have its special quirks? (especially if you develop using Xcode / other tools rather than directly in the docker container). I think the swift.org toolchains give this predictability.

Compiling from the source would allow one to introduce patches to swift before compilation, or even build from custom git branch. But as said above, I don't think this is even desirable for the typical cases. Plus, compilation takes a very long time and is resource intensive.