This document describes the different possibilities to define the scaffolding of applications to be used with Dockership.
The easiest strategy to working with Dockership is to use self-contained repositiories: every repository to be deployed should contain his Dockerfile. Alternatively, the Dockefiles of the different applications of a company can be centralized in a single repository.
This is the simplest way to work with Dockership: Just place a
Dockerfile at the root of your repository. (This is the default location, you can configure your own).
In this example we deploy an AngularJS tool using dockerfile/nginx, the container should retrieve the code through a git clone and execute all the required command to work properly.
FROM dockerfile/nginx # pre requisites RUN apt-get install -y npm nodejs RUN ln -s /usr/bin/nodejs /usr/local/bin/node RUN npm install -g bower grunt karma # source code RUN rm -rf /var/www RUN git clone firstname.lastname@example.org:example/corporate-site.git /var/www # post code commands WORKDIR /var/www RUN npm install RUN bower install --allow-root EXPOSE 80 # boot CMD ["/usr/sbin/nginx"]
This project at the
dockership.ini can be configured as follows:
[Project "corporate-site"] Repository = email@example.com:example/corporate-site.git Port = 0.0.0.0:80:80/tcp Environment = live
Maybe you prefer keep all your company’s
dockerfiles in the same repository, keeping away from the development team those files.
Based on this hypothetic scaffolding:
devops |_ dokerfiles |_ CorporateSiteDokerFile |_ InternalSiteDockerfile
dockership.ini will looks like:
[Project "corporate-site"] Repository = firstname.lastname@example.org:example/devops.git RelatedRepository = email@example.com:example/corporate-site.git Dockerfile = dockerfiles/CorporateSiteDokerFile Port = 0.0.0.0:80:80/tcp Environment = live [Project "internal-site"] Repository = firstname.lastname@example.org:example/devops.git RelatedRepository = email@example.com:example/internal-site.git Dockerfile = dockerfiles/InternalSiteDockerfile Port = 0.0.0.0:80:80/tcp Environment = live
RelatedRepository we can track any change at the deployed project, having the dockerfile in other repository. But we have a caveat, every time a file is changed at the
devops repository even unrelated to the project, this project will look outdated.