Vapor for Docker
This setup has been made with Docker 1.12 for Mac.
You can download Docker For Mac/Windows here
This will remove Docker toolbox and migrate your current containers to Docker Engine if you have any.
You can use the base image to get a simple setup with Vapor & Docker up and running.
Go to your projects root directory and run this command
docker run --rm -ti -v $(pwd):/vapor -p 8080:8080 vapor/vapor:latest
This command will start a container with a mounted directory and build and run the source inside the container. You can access to your app using https://localhost:8080
this image doesn't have MySQL, PGSQL or SQLite
You need to build your own image to extend my base image with MySQL, PGSQL or SQLite.
There is a Dockerfile that makes this really simple.
Clone this repo inside your vapor project, go to the directory
Run this command
docker build -t <your own name to choose> .
We are going to use
vapormysql in this example.
These options can be added to the build line:
So for example to get Swift & Vapor with MySQL support run this
docker build -t vapormysql --build-arg INSTALL_MYSQL=true .
That will make a image with MySQL support based on the base image.
Then you can use the commands i put in the top of this document and replace
You need to name your vapor container for
vapor that is done by adding
--name vapor in the run command for your
Then you go to the folder nginx and build the image
docker build -t nginxvapor .
After the image has been build run it with
docker run -d --link vapor:vapor -p 80:80 nginxvapor
This command will start nginx and run it detached.`