Cloud Foundry buildpacks provide the runtime required to execute your applications on the IBM cloud. When you push an application to IBM Cloud using the Cloud Foundry
cf push command, it automatically detects which buildpack should be used for your application. Once this is determined, the buildpack inspects artifacts in your application to find out what dependencies should be downloaded.
There are many Cloud Foundry buildpacks available (e.g. java_buildpack, ruby_buildpack, nodejs_buildpack) on IBM Cloud. One of the new additions to the Cloud Foundry family of buildpacks that is now available on IBM Cloud is the Cloud Foundry buildpack for Swift. This is really exciting news since you can now push Swift applications to IBM Cloud that follow the structure and conventions required by the Swift Package Manager.
The Cloud Foundry buildpack for Swift parses the .swift_version file to determine which snapshot of the Swift binaries should be used for compiling and building your applicationâ€™s code. If the version of the Swift binaries required for your application isn’t already cached in the buildpack package, then it is downloaded. Note that for each official release of the Cloud Foundry buildpack for Swift, there is a cached package version that includes the latest version of the Swift binaries at the time of release. For instance, the cached package version for release v1.0.3 of the Cloud Foundry buildpack for Swift includes the DEVELOPMENT-SNAPSHOT-2016-02-08-a version of the Swift binaries.
Let’s now use the Cloud Foundry command line to get a list of the buildpacks [along with their versions] that are installed on IBM Cloud by executing
$ cf buildpacks Getting buildpacks... buildpack position enabled locked filename liberty-for-java 1 true false buildpack_liberty-for-java_v2.5-20160209-1336.zip sdk-for-nodejs 2 true false buildpack_sdk-for-nodejs_v3.0-20160125-1224.zip noop-buildpack 3 true false noop-buildpack-20140311-1519.zip java_buildpack 4 true false java-buildpack-v3.5.1.zip ruby_buildpack 5 true false ruby_buildpack-cached-v1.6.7.zip nodejs_buildpack 6 true false nodejs_buildpack-cached-v1.5.0.zip go_buildpack 7 true false go_buildpack-cached-v1.6.2.zip python_buildpack 8 true false python_buildpack-cached-v1.5.1.zip php_buildpack 9 true false php_buildpack-cached-v4.1.5.zip swift_buildpack 10 true false swift_buildpack-cached-v1.0.3.zip ...
Looking closely at the output, you can see an entry for the Cloud Foundry buildpack for Swift. This means you can write applications in the Swift language and deploy them to IBM Cloud without having to import an external or custom buildpack. Simply executing the Cloud Foundry
cf push command from the root folder of your Swift application’s repo will leverage the built-in Cloud Foundry buildpack for Swift on IBM Cloud. You can also include the Deploy to IBM Cloud button on your README.md file to automate the deployment of your Swift application on GitHub to IBM Cloud.
For further details on how to leverage the Cloud Foundry buildpack for Swift for the deployment of Swift applications, we encourage you to check out the README for the swift-helloworld repository on GitHub. You’ll find instructions on how to deploy the Swift Sample Starter application to your IBM Cloud account using the magical Deploy to IBM Cloud button or the Cloud Foundry command line. And to get you up and running even quicker, check out the new The Swift runtime on IBM Cloud that is available in the catalog. The Swift runtime on IBM Cloud leverages the Swift Sample Starter application and the Cloud Foundry buildpack for Swift. It is a great starting point to explore Swift on the server!
We are very excited to have the Cloud Foundry buildpack for Swift and the Swift runtime now available on IBM Cloud! It’ll be very interesting to see the types of Swift applications that developers will implement and deploy to IBM Cloud. And remember that if you’d like to push Swift applications to IBM Cloud, you no longer need to bring your own buildpack!
Ricardo Olivieri, Senior Software Engineer, IBM Swift Engineering at IBM Cloud