Deploying Using a Dockerfile

In addition to using the pre-defined buildpacks, you can create a completely custom environment by deploying a Dockerfile. This will build the docker image on the Deis cluster and deploy it.

To use a Dockerfile, simply add it to the root of your repository.

Create a Dockerfile

There are three rules that must be adhered to for deploying a Dockerfile to Deis:

  1. The Dockerfile must EXPOSE only one port
  2. The port must be listening for a HTTP connection
  3. A default CMD must be specified for running the container

Here we create a simple Dockerfile that installs jekyll and serves up an example blog:

FROM ubuntu:wily

RUN apt-get update -qq
RUN apt-get install -y -q ruby ruby-dev ruby-posix-spawn python-pygments git build-essential nodejs
RUN gem install -V rdiscount jekyll

RUN git clone https://github.com/maciakl/Sample-Jekyll-Site.git blog
WORKDIR blog

EXPOSE 4000

CMD ["jekyll", "serve", "-H", "0.0.0.0"]

Deploying to Deis

As when deploying using a buildpack, you simply need to create the application, and push to it.

$ deis create
$ git push deis master

To verify that it deployed successfully, you can run deis open to pull up the site in your browser.