{"id":13800312,"url":"https://github.com/Kitura/swift-ubuntu-docker","last_synced_at":"2025-05-13T09:31:31.195Z","repository":{"id":115294872,"uuid":"51377089","full_name":"Kitura/swift-ubuntu-docker","owner":"Kitura","description":"🚫 This repo is deprecated - please use the images here: https://hub.docker.com/_/swift","archived":false,"fork":false,"pushed_at":"2019-07-16T21:15:31.000Z","size":170,"stargazers_count":153,"open_issues_count":0,"forks_count":35,"subscribers_count":29,"default_branch":"master","last_synced_at":"2025-05-08T03:05:44.336Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Vim script","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Kitura.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2016-02-09T15:51:19.000Z","updated_at":"2024-11-23T13:40:29.000Z","dependencies_parsed_at":null,"dependency_job_id":"6c94e30a-f8dc-438e-a950-ab97bd0a3003","html_url":"https://github.com/Kitura/swift-ubuntu-docker","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kitura%2Fswift-ubuntu-docker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kitura%2Fswift-ubuntu-docker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kitura%2Fswift-ubuntu-docker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kitura%2Fswift-ubuntu-docker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Kitura","download_url":"https://codeload.github.com/Kitura/swift-ubuntu-docker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253913106,"owners_count":21983259,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-04T00:01:11.353Z","updated_at":"2025-05-13T09:31:29.842Z","avatar_url":"https://github.com/Kitura.png","language":"Vim script","funding_links":[],"categories":["Platform"],"sub_categories":[],"readme":"[![Build Status - Master](https://travis-ci.org/IBM-Swift/swift-ubuntu-docker.svg?branch=master)](https://travis-ci.org/IBM-Swift/swift-ubuntu-docker)\n\n# Swift 5 - Ubuntu Docker\n\nThis repo contains the code for generating two Docker images for Swift:\n\n- The `ibmcom/swift-ubuntu` image contains the Swift 5.0.2 RELEASE toolchain as well as the dependencies for running Kitura-based applications. Our development team uses this image for development and testing of Swift 5 applications on the Linux Ubuntu (v14.04) operating system.\n- The `ibmcom/swift-ubuntu-runtime` image contains only those libraries (`.so` files) provided by the Swift 5.0.2 RELEASE toolchain that are required to run Swift applications. Note that this image does not contain SwiftPM or any of the build tools used when compiling and linking Swift applications. Hence, the size for the `ibmcom/swift-ubuntu-runtime` image (~300 MB) is much smaller than that of the `ibmcom/swift-ubuntu` image. The `ibmcom/swift-ubuntu-runtime` image is ideal for provisioning your Swift application as an [IBM Container](https://www.ibm.com/cloud-computing/bluemix/containers) on the IBM Cloud.\n\n- The `ibmcom/swift-ubuntu-xenial` and `ibmcom/swift-ubuntu-xenial-runtime` images follow a similar convention, but for Linux Ubuntu 16.04. These images are multi-arch so will pull down the appropriate image for your architecture. We currently offer support for `amd64` and `s390x` architectures.\n\n# Recent updates\n1. Upgraded to the Swift 5.0.2 RELEASE binaries.\n2. Changed location of Swift binaries and libraries so they are available system wide (not just for the `root` user).\n3. Reduced number of layers in images.\n4. Removed system packages no longer needed.\n5. Aligned version of Ubuntu with version found in Cloud Foundry environments (v14.04).\n6. Reduced size of the Docker image.\n7. Updated Dockerfiles per guidelines in [Best practices for writing Dockerfiles](https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/).\n8. Added Support for amd64 and s390x architectures of Xenial Linux Ubuntu 16.04.\n\n\n\n# Quick Start\n\nThe easiest way to get started is by using the Kitura command line tools to generate the docker files needed, and copy them over to your project. If you just want to explore our supported base images, see the next sections.\n\nTo get started with `kitura init`:\n\n1. Create a new directory, change into it and run [`kitura init`](https://www.kitura.io/docs/getting-started/create-server-cli.html#). This will generate a project which will include two files named `Dockerfile` and `Dockerfile-tools`.\n2. Copy the `Dockerfile` and `Dockerfile-tools` files into your project's root directory (this is the directory that contains your `Package.swift` file and the Sources and Tests folders).\n3. Edit the `Dockerfile` in a text editor and replace references to your `kitura init` folder with the name of your project. `Dockerfile-Tools` has preconfigured behavior to download and compile Swift binaries and copy the executable into your application. It doesn't need editing.\n4. Run the following commands, replacing YOUR_PROJECT with the name of your project. **Note:** Use all lower case letters for your projects name and replace spaces with dashes.\n   1. `docker build -t YOUR_PROJECT-build -f Dockerfile-tools .`\n   2. `docker run -v $PWD:/root/project -w /root/project YOUR_PROJECT-build /swift-utils/tools-utils.sh build release`\n   3. `docker run -it -p 8090:8080 -v $PWD:/root/project -w /root/project YOUR_PROJECT-run sh -c \".build-ubuntu/release/YOUR_PROJECT\"`\n\n`Dockerfile-tools` is responsible for downloading the Swift binaries and builds the exectuables.\n\nThe `Dockerfile` then copies the applications source code, and then compiled executable into the runtime image of the application. This means the large Swift binary file isn't copied into your application, and reduces the overall size of your app, meaning faster uploads and a smaller storage quota impact.\n\nThe final command runs your Docker image locally.\n\nThis was the quickest way to get started, but if you just want see explore our base images then see the following sections for detailed instructions.\n\n\n# ibmcom/swift-ubuntu\n## Pulling ibmcom/swift-ubuntu from Docker Hub\nRun the following command to download the latest version of the `ibmcom/swift-ubuntu` image from Docker Hub:\n\n```\ndocker pull ibmcom/swift-ubuntu:latest\n```\n\n### Use a specific version of ibmcom/swift-ubuntu\nDocker images are tagged with Swift version number. To use the Swift 5.0.2 image from Docker Hub, issue the following command:\n\n```\ndocker pull ibmcom/swift-ubuntu:5.0.2\n```\n\n## Using ibmcom/swift-ubuntu for development\nMount a folder on your host to your Docker container using the following command:\n\n```\ndocker run -i -t -v \u003cabsolute path to the swift package\u003e:/\u003cswift package name\u003e ibmcom/swift-ubuntu:5.0.2\n```\n\nAfter executing the above command, you will have terminal access to the Docker container (the default command for the image is `/bin/bash`). This will allow you to build, test, and run your Swift application in a Linux environment (Ubuntu v14.04).\n\n## Privileged mode\nIf you attempt to run the Swift REPL and you get the error `failed to launch REPL process: process launch failed: 'A' packet returned an error: 8`, then you should run your Docker container in privileged mode:\n\n```\ndocker run --privileged -i -t ibmcom/swift-ubuntu:5.0.2\n```\n\nThis issue is described at https://bugs.swift.org/browse/SR-54.\n\n# ibmcom/swift-ubuntu-xenial\n## Pulling ibmcom/swift-ubuntu-xenial from Docker Hub\nRun the following command to download the latest version of the `ibmcom/swift-ubuntu-xenial` image from Docker Hub:\n\n```\ndocker pull ibmcom/swift-ubuntu-xenial:latest\n```\nThis image supports both amd64 and s390x architectures and will pull down the correct image based on the architecture you are using i.e. `ibmcom/swift-ubuntu-xenial-amd64` or `ibmcom/swift-ubuntu-xenial-s390x`.\n\n## Using ibmcom/swift-ubuntu-xenial for development\nMount a folder on your host to your Docker container using the following command:\n\n```\ndocker run -i -t -v \u003cabsolute path to the swift package\u003e:/\u003cswift package name\u003e ibmcom/swift-ubuntu-xenial:latest\n```\n\nAfter executing the above command, you will have terminal access to the Docker container (the default command for the image is `/bin/bash`). This will allow you to build, test, and run your Swift application in a Linux environment (Ubuntu v16.04, amd64 or s390x), depending on your architecture.\n\n## Privileged mode\nIf you attempt to run the Swift REPL and you get the error `failed to launch REPL process: process launch failed: 'A' packet returned an error: 8`, then you should run your Docker container in privileged mode:\n\n```\ndocker run --privileged -i -t ibmcom/swift-ubuntu-xenial:latest\n```\n\nThis issue is described at https://bugs.swift.org/browse/SR-54.\n\n# ibmcom/swift-ubuntu-runtime\n## Pulling ibmcom/swift-ubuntu-runtime from Docker Hub\nRun the following command to download the latest version of the `ibmcom/swift-ubuntu-runtime` image from Docker Hub:\n\n```\ndocker pull ibmcom/swift-ubuntu-runtime:latest\n```\n\n### Use a specific version of ibmcom/swift-ubuntu-runtime\nDocker images are now tagged with Swift version number. To use the Swift 5.0.2 image from Docker Hub, issue the following command:\n\n```\ndocker pull ibmcom/swift-ubuntu-runtime:5.0.2\n```\n\n## Using ibmcom/swift-ubuntu-runtime\nYou can extend the `ibmcom/swift-ubuntu-runtime` image in your own Dockerfile to add your Swift application binaries (and any other dependencies you may need). For instance, the next sample Dockerfile simply adds the binaries for the [Kitura-Starter](https://github.com/IBM-Bluemix/Kitura-Starter) application and specifies the command to start the server (total image size after adding the Kitura-Starter binaries is ~300MB):\n\n```\n# Builds a Docker image for running the Kitura-Starter sample application.\n\n...\n\nFROM ibmcom/swift-ubuntu-runtime:5.0.2\nLABEL Description=\"Docker image for running the Kitura-Starter sample application.\"\n\nUSER root\n\n# Expose default port for Kitura\nEXPOSE 8080\n\n# Binaries should have been compiled against the correct platform (i.e. Ubuntu 14.04).\nRUN mkdir /Kitura-Starter\nADD .build/debug/Kitura-Starter /Kitura-Starter\nADD .build/debug/*.so /Kitura-Starter\nADD .build/debug/*.so.* /Kitura-Starter\nCMD [ \"sh\", \"-c\", \"/Kitura-Starter/Kitura-Starter\" ]\n```\n\nFor details on how to create an IBM Container to execute a Swift application, please see [10 Steps To Running a Swift App in an IBM Container](https://developer.ibm.com/swift/2016/02/22/10-steps-to-running-a-swift-app-in-an-ibm-container) and [Running Kitura in an IBM Container](https://developer.ibm.com/swift/2016/03/04/running-kitura-in-an-ibm-container/).\n\n# Exposing ports in your Docker container\nExposing your server's port running in a Docker container to the host system (e.g. macOS) is quite easy using the latest version of Docker:\n\n```\ndocker run -p \u003chost port\u003e:\u003ccontainer port\u003e [additional options] \u003cimage name\u003e\n```\n\nFor example, if your Swift server is running on port `8080`, and you want to make it accessible via port `9080` on the host system, run the following command:\n\n```\ndocker run -p 9080:8080 [additional options] \u003cimage name\u003e\n```\n\nPort `8080` in the container will then be mapped to port `9080` on the host system. For further details on the `-p` option, see the official Docker [documentation](https://docs.docker.com/engine/reference/run/#/expose-incoming-ports).\n\n# Contributing\n\nImprovements are very welcome! You can find more info on contributing in our [contributing guidelines](.github/CONTRIBUTING.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FKitura%2Fswift-ubuntu-docker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FKitura%2Fswift-ubuntu-docker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FKitura%2Fswift-ubuntu-docker/lists"}