title: How to translate docker-compose.yml to Dockerfile
body: <p>I have an application written in Django and I am trying to run it in docker on Digital Ocean droplet. Currently I have two files.</p>
  
  <p>Can <em>anybody</em> advise how to get rid of <code>docker-compose.yml</code> file and integrate all the commands within <code>Dockerfile</code> ???</p>
  
  <p><strong><em>Dockerfile</em></strong></p>
  
  <pre><code>FROM python:3
  ENV PYTHONUNBUFFERED 1
  RUN mkdir /code
  WORKDIR /code
  COPY . /code/
  RUN pip install -r reqirements.txt
  RUN python /code/jk/manage.py collectstatic --noinput
  </code></pre>
  
  <p><strong><em>docker-compose.yml</em></strong></p>
  
  <pre><code>version: '3'
  services:
    web:
      build: .
      command: python jk/manage.py runserver 0.0.0.0:8081
      volumes:
        - .:/code
      ports:
        - "8081:8081"
  </code></pre>
  
  <p>I run my application and docker image like following:</p>
  
  <ul>
  <li><code>docker-compose run web python jk/manage.py migrate</code></li>
  <li><code>docker-compose up</code></li>
  </ul>
  
  <p>output:</p>
  
  <pre><code>Starting workspace_web_1 ...
  Starting workspace_web_1 ... done
  Attaching to workspace_web_1
  web_1  | Performing system checks...
  web_1  |
  web_1  | System check identified no issues (0 silenced).
  web_1  | December 02, 2017 - 09:20:51
  web_1  | Django version 1.11.3, using settings 'jk.settings'
  web_1  | Starting development server at http://0.0.0.0:8081/
  web_1  | Quit the server with CONTROL-C.
  ...
  </code></pre>
  
  <hr>
  
  <p>Ok so I have take the following approach:
  <strong><em>Dockerfile</em></strong></p>
  
  <pre><code>FROM python:3
  ENV PYTHONUNBUFFERED 1
  RUN mkdir /code
  WORKDIR /code
  COPY . /code/
  RUN pip install -r reqirements.txt
  RUN python /code/jk/manage.py collectstatic --noinput
  </code></pre>
  
  <p>then I ran:</p>
  
  <pre><code> docker build -t "django:v1" .
  </code></pre>
  
  <p>So <code>docker images -a</code> throws:</p>
  
  <pre><code>docker images -a
  REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
  django              v1                  b3dec6aaf9b9        5 minutes ago       949MB
  &lt;none&gt;              &lt;none&gt;              55370397f7f2        5 minutes ago       948MB
  &lt;none&gt;              &lt;none&gt;              e7eba7113203        7 minutes ago       693MB
  &lt;none&gt;              &lt;none&gt;              dc3d7705c45a        7 minutes ago       691MB
  &lt;none&gt;              &lt;none&gt;              12825382746d        7 minutes ago       691MB
  &lt;none&gt;              &lt;none&gt;              2304087e8b82        7 minutes ago       691MB
  python              3                   79e1dc9af1c1        3 weeks ago         691MB
  </code></pre>
  
  <p>And finally I ran:</p>
  
  <pre><code>cd /opt/workspace
  docker run -d -v /opt/workspace:/code -p 8081:8081 django:v1 python jk/manage.py runserver 0.0.0.0:8081
  </code></pre>
  
  <p>Two simple questions:</p>
  
  <ol>
  <li>do i get it right that each <code>&lt;none&gt;</code> listed image is created when running <code>docker build -t "django:v1" .</code> command to build up my image ... So it means that it consumes like <code>[(691 x 4) + (693 x 1) + (948) + (949)]MB</code> of <em>disk space</em> ??</li>
  <li>Is it better to use <strong><em>gunicorn</em></strong> or <strong><em>wsgi</em></strong> program to run django in production ? </li>
  </ol>
  
  <p>And responses from @vmonteco:</p>
  
  <ol>
  <li>I think so, but a way to reduce the size taken by your images is to reduce their number by using a single RUN directive for several chained commands in your Dockerfile. (RUN cmd1 &amp;&amp; cmd2 rather than RUN cmd1 then RUN cmd</li>
  <li>It's up to you to make your own opinion. I personnally use uWSGI but there even are other choices than gunicorn/uwsgi (Not just "wsgi", that's the name of a specification for interface, not a programm). Have fun finding your prefered one! :) </li>
  </ol>