[Deis documentation] using Deis using Dockerfiles

Note: This article translated from Deis official documents, without any commercial purposes, reproduced please indicate the source.

Deis supports deploying applications through Dockerfiles. A Dockerfile automates the process of making a Docker image . Dockerfiles are incredibly powerful, but require some extra work to define the application runtime you need.

Prepare the application in advance

If you do not have an existing application, you can clone a sample application to prove the Dockerfile workflow.
$ git clone https://github.com/deis/helloworld.git
$ cd helloworld

Dockerfile requirements

In order to deploy the Dockerfile application, they must be consistent with the following requirements:
– Dockerfile must be exposed (EXPOSE) only one port
– The exposed port must be an HTTP service that can be connected to an HTTP router
– A default CMD must be specified for a running container

note
Dockerfiles exposes more than one port that will be discussed in issue 1156.

Create an application

Use deis create to create an application in the Controller .
$ deis create
Creating application... done, created folksy-offshoot
Git remote deis added

Use push deployment

Use git push deis master deploy your application.

  $ Git push deis master 
Counting objects: 13, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (13/13), done.
Writing objects: 100% (13/13), 1.99 KiB | 0 bytes / s, done.
Total 13 (delta 2), reused 0 (delta 0)
-----> Building Docker image
Uploading context 4.096 kB
Uploading context
Step 0: FROM deis / base: latest
---> 60024338bc63
Step 1: MAINTAINER OpDemand <info@opdemand.com>
---> Using cache
---> 2af5ad7f28d6
Step 2: RUN wget -O /tmp/go1.2.1.linux-amd64.tar.gz -q https://go.googlecode.com/files/go1.2.1.linux-amd64.tar.gz
---> Using cache
---> cf9ef8c5caa7
Step 3: RUN tar -C / usr / local -xzf /tmp/go1.2.1.linux-amd64.tar.gz
---> Using cache
---> 515b1faf3bd8
Step 4: RUN mkdir -p / go
---> Using cache
---> ebf4927a00e9
Step 5: ENV GOPATH / go
---> Using cache
---> c6a276eded37
Step 6: ENV PATH / usr / local / go / bin: / go / bin: $ PATH
---> Using cache
---> 2ba6f6c9f108
Step 7: ADD. /go/src/github.com/deis/helloworld
---> 94ab7f4b977b
Removing any container 171b7d9fdb34
Step 8: RUN cd /go/src/github.com/deis/helloworld && go install -v.
---> Running in 0c8fbb2d2812
Github.com/deis/helloworld
---> 13b5af931393
Removing any container 0c8fbb2d2812
Step 9: ENV PORT 80
---> Running in 9b07da36a272
---> 2dce83167874
Removing any container 9b07da36a272
Step 10: CMD ["/ go / bin / helloworld"]
---> Running in f7b215199940
---> b1e55ce5195a
Removing any container f7b215199940
Step 11: EXPOSE 80
---> Running in 7eb8ec45dcb0
---> ea1a8cc93ca3
Removing any container 7eb8ec45dcb0
Successfully built ea1a8cc93ca3
-----> Pushing image to private registry

Launching ... done, v2

-----> folksy-offshoot deployed to Deis
Http://folksy-offshoot.local.deisapp.com

To learn more, use `deis help` or visit http://deis.io

To ssh: //git@local.deisapp.com: 2222 / folksy-offshoot.git
* [New branch] master -> master

$ Curl -s http://folksy-offshoot.local.deisapp.com
Welcome to Deis!
See the documentation at http://docs.deis.io/ for more information.

Because a Dockerfile application was detected, the cmd process type was automatically expanded to 1 at the time of the first deployment.

Define the process type

The Docker container has a default command, usually specified by the CMD instruction . Deis uses the cmd process type to refer to this default command.
Deis also supports the expansion of other process types defined in a Procfile . In order to use this feature, you must:
1. Use your repository root directory Procfile to define the process type (process types)
2. Include a start executable, you can use start &lt;process-type> call

Heads up! This alert needs your attention, but it's not super important.