docker/fig — pull request #473 by adam-ard (2014-09-05 18:47:10+00:00)
Title: Allow Dockerfiles in build field

A potential stop-gap solution for this: https://github.com/docker/docker/issues/2112. While a proper solution is being developed, to allow one Dockerfile to handle multiple targets ( or whatever solution in decided upon ), this code simply copies the Dockerfile that is being built to a file named Dockerfile, then deletes it after the build is done. If there is already a Dockerfile in that directory, it is copied to a backup location and restored after the build. If a path is specified, then the behavior is the same as previously.

Allows for a fig.yml that looks like this:

db:
image: postgres
ports:
- "5432"
dev:
build: dev.Dockerfile
command: bundle exec rails server
ports:
- "3000:3000"
links:
- db
prod:
build: prod.Dockerfile
command: bundle exec rails server
ports:
- "3001:3000"
links:
- db
test:
build: test.Dockerfile
command: bundle exec rails server
ports:
- "3002:3000"
links:
- db

Signed-off-by: Adam Ard