Deploy with Docker
Step 1: Build compile image
The compiler is rather large, we don't want to include this in the overall build image.
To prevent this with have a build image and a run image. The run image contains just the compiled code.
We first need to build the compile image:
docker build -t myapp-build -f Dockerfile-tools .
Step 2: Compile application code
Using the image we've just built we can compile the application code.
docker run -v $PWD:/swift-project -w /swift-project myapp-build /swift-utils/tools-utils.sh build release
Step 3: Build the run image
Now we can build the image containing the compiled application code.
docker build -t myapp-run .
Step 4: Start the Docker container
We have an image that contains all of our application code so now we just need to start it.
docker run -p 8080:8080 -it myapp-run