Setup using docker to compile code on linux as not using Ubuntu as operating system.
Install docker on your linux system by the normal way.
Go to docker hub, Swift Image web address https://hub.docker.com/_/swift/ for for info.
Download the Swift docker image from docker hub from the terminal. Using the command below.
sudo docker pull swift
Create the swift docker container from the Image
and Attach it
, the name (swiftfun) can be changed to anything you want to.
sudo docker run -it --name swiftfun swift /bin/bash
To Start and Attach Your Image Later: Start your image with the name you used, the above example uses swiftfun
sudo docker start swiftfun
and then attach it
sudo docker attach swiftfun
Compile yor code inside the Docker container
sudo docker run --rm --user "$(id -u)":"$(id -g)" -v "$PWD":/usr/src/myapp -w /usr/src/myapp swift:latest swift build
this will compile your code in the current directory and put the build files in the same directory.