Skip to content

Commit

Permalink
Merge pull request #4499 from bgeuken/reduce_build_context_multi
Browse files Browse the repository at this point in the history
[dist] Parallelize docker builds with rake multitask
  • Loading branch information
bgeuken committed Feb 15, 2018
2 parents 7ca851d + 8279faa commit b5899e7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
19 changes: 11 additions & 8 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -69,34 +69,37 @@ namespace :docker do
end

desc 'Rebuild all our static containers'
task rebuild: ['rebuild:base', 'rebuild:backend', 'rebuild:frontend-base', 'rebuild:mariadb', 'rebuild:memcached', 'rebuild:old-test-suite'] do
multitask rebuild: ['rebuild:all'] do
end
namespace :rebuild do
multitask all: [:base, :backend, 'frontend-base', :mariadb, :memcached, 'old-test-suite'] do
end
task :base do
sh "docker build docker-files/base/ #{tags_for(:base)} -f docker-files/base/Dockerfile.#{VERSION}"
end
task :mariadb do
task mariadb: [:base] do
sh "docker build docker-files/mariadb/ #{tags_for(:mariadb)} -f docker-files/mariadb/Dockerfile.mariadb"
end
task :memcached do
task memcached: [:base] do
sh "docker build docker-files/memcached/ #{tags_for(:memcached)} -f docker-files/memcached/Dockerfile.memcached"
end
task 'frontend-base' do
task 'frontend-base' => [:base] do
sh "docker build src/api/ #{tags_for('frontend-base')} -f src/api/docker-files/Dockerfile.frontend-base"
end
task :backend do
task backend: [:base] do
sh "docker build src/backend/ #{tags_for(:backend)} -f src/backend/docker-files/Dockerfile.backend"
end
task 'old-test-suite' do
task 'old-test-suite' => [:base] do
sh "docker build src/api/ #{tags_for('old-test-suite')} -f src/api/docker-files/Dockerfile.old-test-suite"
end
end

desc 'Rebuild and publish all our static containers'
task publish: [:rebuild, 'publish:base', 'publish:mariadb', 'publish:memcached', 'publish:backend', 'publish:frontend-base', \
'publish:old-test-suite'] do
task publish: [:rebuild, 'publish:all'] do
end
namespace :publish do
multitask all: [:base, :mariadb, :memcached, :backend, 'frontend-base', 'old-test-suite'] do
end
task :base do
sh "docker push openbuildservice/base:#{VERSION}"
sh 'docker push openbuildservice/base'
Expand Down
2 changes: 2 additions & 0 deletions docker-compose.ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ version: "2"
services:
rspec:
image: openbuildservice/frontend
environment:
- LANG=en_US.UTF-8
volumes:
- .:/obs
depends_on:
Expand Down

0 comments on commit b5899e7

Please sign in to comment.