Permalink
Browse files

Let the docker variable be used to specify which subdirs to look in

If you don't specify the subdir, all top level dirs are automatically
scanned. Alternatively, following the example, you can specify exactly
which Dockerfiles you want to have build.
  • Loading branch information...
1 parent 2742951 commit 853073431d227cbb0ba56aaf4fedd721904de9a8 @purpleidea committed Jul 2, 2015
Showing with 42 additions and 1 deletion.
  1. +33 −0 examples/docker-subdirs.yaml
  2. +9 −1 vagrant/Vagrantfile
@@ -0,0 +1,33 @@
+---
+:domain: example.com
+:network: 192.168.123.0/24
+:image: centos-7.1-docker
+:boxurlprefix: ''
+:sync: rsync
+:folder: ''
+:extern:
+- type: git
+ system: docker
+ repository: https://github.com/fedora-cloud/Fedora-Dockerfiles
+ directory: Fedora-Dockerfiles
+:puppet: false
+:classes: []
+:docker:
+ images: []
+ files:
+ - Fedora-Dockerfiles/apache
+ - Fedora-Dockerfiles/wordpress
+:kubernetes: false
+:ansible: []
+:playbook: []
+:cachier: false
+:vms: []
+:namespace: omv
+:count: 1
+:username: ''
+:password: ''
+:poolid: true
+:repos: []
+:update: false
+:comment: sub folder simple docker file build example
+:reallyrm: false
View
@@ -604,6 +604,7 @@ if extern.length > 0
repository = File.expand_path(repository)
end
directory = i.fetch('directory', nil)
+ directory = directory[0, (directory.index('/', 1).nil?? directory.length : directory.index('/', 1))]
branch = i.fetch('branch', nil)
if repository.nil? or directory.nil?
next
@@ -994,7 +995,14 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# docker build
if vm_docker # for any value that is not false
- Dir.glob(docker_basedir+'*').each do |dd|
+ dlist = Dir.glob(docker_basedir+'*')
+ if vm_docker.is_a?(Hash)
+ dfiles = vm_docker.fetch('files', nil)
+ if dfiles.is_a?(Array)
+ dlist = vm_docker['files'].map{|dfile| File.join(docker_basedir, dfile)}
+ end
+ end
+ dlist.each do |dd|
if not File.directory?(dd)
next # invalid, skip
end

0 comments on commit 8530734

Please sign in to comment.