Even though writing a Dockerfile is pretty much the same as composing a build script, there are some more factors that we should consider to build efficient, secure, and stable images. Moreover, a Dockerfile itself is also a document. Keeping it readable makes it easier to manage.
Let's say we have an application stack that consists of application code, a database, and a cache. The initial Dockerfile of our stack could be the following:
FROM ubuntuADD . /projRUN apt-get updateRUN apt-get upgrade -yRUN apt-get install -y redis-server python python-pip mysql-serverADD /proj/db/my.cnf /etc/mysql/my.cnfADD /proj/db/redis.conf /etc/redis/redis.confADD https://example.com/otherteam/dep.tgz /tmp/RUN -zxf /tmp/dep.tgz -C /usr/src ...