├── Dockerfile └── README.md /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:16.04 2 | 3 | LABEL maintainer="zyxep" 4 | 5 | # Install CURL 6 | RUN apt-get update && \ 7 | apt-get -y install curl && \ 8 | rm -rf /var/lib/apt/lists/*; 9 | 10 | # Get Vapor repo including Swift 11 | RUN curl -sL https://apt.vapor.sh | bash; 12 | 13 | # Installing Swift & Vapor 14 | RUN apt-get update && \ 15 | apt-get -y install swift vapor && \ 16 | rm -rf /var/lib/apt/lists/*; 17 | 18 | WORKDIR /vapor 19 | 20 | RUN ["vapor", "--help"] 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Vapor for Docker [DEPRECATED, see this [guide](https://bygri.github.io)] 2 | 3 | This setup has been made with Docker 1.12 for Mac. 4 | You can download Docker For Mac/Windows here 5 | [Mac](https://download.docker.com/mac/stable/Docker.dmg) 6 | 7 | This will remove Docker toolbox and migrate your current containers to Docker Engine if you have any. 8 | 9 | The [base image](https://hub.docker.com/r/vapor/vapor/) is build on Ubuntu 16.04 with [Swift](https://github.com/apple/swift) 3.1 and [Vapor toolbox](https://github.com/vapor/toolbox) 10 | 11 | ## Simple setup 12 | You can use the base image to get a simple setup with Vapor & Docker up and running. 13 | Go to your projects root directory and run this command 14 | 15 | `docker run --rm -ti -v $(pwd):/vapor -p 8080:8080 vapor/vapor:latest` 16 | 17 | 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 18 | 19 | **this image doesn't have MySQL, PGSQL or SQLite** 20 | 21 | ## Extended setup 22 | You need to build your own image to extend my base image with MySQL, PGSQL or SQLite. 23 | There is a Dockerfile that makes this really simple. 24 | 25 | Clone this repo inside your vapor project, go to the directory `/docker/vapor`. 26 | Run this command 27 | 28 | `docker build -t .` 29 | We are going to use `vapormysql` in this example. 30 | 31 | These options can be added to the build line: 32 | ##### MySQL 33 | `--build-arg INSTALL_MYSQL=true` 34 | 35 | ##### PGSQL 36 | `--build-arg INSTALL_PGSQL=true` 37 | 38 | ##### SQLite 39 | `--build-arg INSTALL_SQLITE=true` 40 | 41 | So for example to get Swift & Vapor with MySQL support run this 42 | `docker build -t vapormysql --build-arg INSTALL_MYSQL=true .` 43 | 44 | That will make a image with MySQL support based on the base image. 45 | Then you can use the commands i put in the top of this document and replace `vapor/vapor:latest` with `vapormysql`. 46 | 47 | ##### Nginx 48 | You need to name your vapor container for `vapor` that is done by adding `--name vapor` in the run command for your `vapor` image. 49 | Then you go to the folder nginx and build the image `docker build -t nginxvapor .` 50 | 51 | After the image has been build run it with `docker run -d --link vapor:vapor -p 80:80 nginxvapor` 52 | This command will start nginx and run it detached.` 53 | --------------------------------------------------------------------------------