Automating publishing docker images

I’m running Docker version 17.03.0-ce, build 60ccb22 on Ubuntu 16.0.4. My container derives from php:7.1-apache. The Dockerfile and docker-compose.yml live in the root my of git repository. The repo is mounted to the container with the following docker-compose line:


  • .:/var/www

This is a great development image. All dependent containers (e.g. RDBMS) are configured in docker-compose.yml. and subdirectories of the provision folder. However, is there a good pattern of how I can have a docker file in the same repo that is designed for creating a docker image of that repository with a static copy of my code at a particular tag, for publishing to docker hub?