github.com/greenboxal/deis@v1.12.1/docs/using_deis/using-dockerfiles.rst (about)

     1  :title: Deploying with Dockerfiles on Deis
     2  :description: How to deploy applications on Deis using Dockerfiles
     3  
     4  .. _using-dockerfiles:
     5  
     6  Using Dockerfiles
     7  =================
     8  Deis supports deploying applications via Dockerfiles.  A `Dockerfile`_ automates the steps for crafting a `Docker Image`_.
     9  Dockerfiles are incredibly powerful but require some extra work to define your exact application runtime environment.
    10  
    11  Prepare an Application
    12  ----------------------
    13  If you do not have an existing application, you can clone an example application that demonstrates the Dockerfile workflow.
    14  
    15  .. code-block:: console
    16  
    17      $ git clone https://github.com/deis/helloworld.git
    18      $ cd helloworld
    19  
    20  Dockerfile Requirements
    21  ^^^^^^^^^^^^^^^^^^^^^^^
    22  In order to deploy Dockerfile applications, they must conform to the following requirements:
    23  
    24   * The Dockerfile must EXPOSE only one port
    25   * The port must be listening for a HTTP connection
    26   * A default CMD must be specified for running the container
    27  
    28  .. note::
    29  
    30      Dockerfiles which expose more than one port will hit `issue 1156`_.
    31  
    32  Create an Application
    33  ---------------------
    34  Use ``deis create`` to create an application on the :ref:`controller`.
    35  
    36  .. code-block:: console
    37  
    38      $ deis create
    39      Creating application... done, created folksy-offshoot
    40      Git remote deis added
    41  
    42  Push to Deploy
    43  --------------
    44  Use ``git push deis master`` to deploy your application.
    45  
    46  .. code-block:: console
    47  
    48      $ git push deis master
    49      Counting objects: 13, done.
    50      Delta compression using up to 8 threads.
    51      Compressing objects: 100% (13/13), done.
    52      Writing objects: 100% (13/13), 1.99 KiB | 0 bytes/s, done.
    53      Total 13 (delta 2), reused 0 (delta 0)
    54      -----> Building Docker image
    55      Uploading context 4.096 kB
    56      Uploading context
    57      Step 0 : FROM deis/base:latest
    58       ---> 60024338bc63
    59      Step 1 : RUN wget -O /tmp/go1.2.1.linux-amd64.tar.gz -q https://go.googlecode.com/files/go1.2.1.linux-amd64.tar.gz
    60       ---> Using cache
    61       ---> cf9ef8c5caa7
    62      Step 2 : RUN tar -C /usr/local -xzf /tmp/go1.2.1.linux-amd64.tar.gz
    63       ---> Using cache
    64       ---> 515b1faf3bd8
    65      Step 3 : RUN mkdir -p /go
    66       ---> Using cache
    67       ---> ebf4927a00e9
    68      Step 4 : ENV GOPATH /go
    69       ---> Using cache
    70       ---> c6a276eded37
    71      Step 5 : ENV PATH /usr/local/go/bin:/go/bin:$PATH
    72       ---> Using cache
    73       ---> 2ba6f6c9f108
    74      Step 6 : ADD . /go/src/github.com/deis/helloworld
    75       ---> 94ab7f4b977b
    76      Removing intermediate container 171b7d9fdb34
    77      Step 7 : RUN cd /go/src/github.com/deis/helloworld && go install -v .
    78       ---> Running in 0c8fbb2d2812
    79      github.com/deis/helloworld
    80       ---> 13b5af931393
    81      Removing intermediate container 0c8fbb2d2812
    82      Step 8 : ENV PORT 80
    83       ---> Running in 9b07da36a272
    84       ---> 2dce83167874
    85      Removing intermediate container 9b07da36a272
    86      Step 9 : CMD ["/go/bin/helloworld"]
    87       ---> Running in f7b215199940
    88       ---> b1e55ce5195a
    89      Removing intermediate container f7b215199940
    90      Step 10 : EXPOSE 80
    91       ---> Running in 7eb8ec45dcb0
    92       ---> ea1a8cc93ca3
    93      Removing intermediate container 7eb8ec45dcb0
    94      Successfully built ea1a8cc93ca3
    95      -----> Pushing image to private registry
    96  
    97             Launching... done, v2
    98  
    99      -----> folksy-offshoot deployed to Deis
   100             http://folksy-offshoot.local3.deisapp.com
   101  
   102             To learn more, use `deis help` or visit http://deis.io
   103  
   104      To ssh://git@local3.deisapp.com:2222/folksy-offshoot.git
   105       * [new branch]      master -> master
   106  
   107      $ curl -s http://folksy-offshoot.local3.deisapp.com
   108      Welcome to Deis!
   109      See the documentation at http://docs.deis.io/ for more information.
   110  
   111  Because a Dockerfile application is detected, the ``cmd`` process type is automatically scaled to 1 on first deploy.
   112  
   113  Use ``deis scale cmd=3`` to increase ``cmd`` processes to 3, for example. Scaling a
   114  process type directly changes the number of :ref:`Containers <container>`
   115  running that process.
   116  
   117  
   118  .. _`Dockerfile`: https://docs.docker.com/reference/builder/
   119  .. _`Docker Image`: https://docs.docker.com/introduction/understanding-docker/
   120  .. _`CMD instruction`:  https://docs.docker.com/reference/builder/#cmd
   121  .. _`issue 1156`: https://github.com/deis/deis/issues/1156
   122  .. _`Procfile`: https://devcenter.heroku.com/articles/procfile