Skip to content

Commit

Permalink
Refactoring base image instruction
Browse files Browse the repository at this point in the history
  • Loading branch information
rheinwein committed Sep 9, 2015
1 parent 246a94b commit edca8a5
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 25 deletions.
3 changes: 0 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,3 @@ DEPENDENCIES
rspec (~> 3.3)
simplecov (~> 0.10.0)
simplecov-rcov (~> 0.2.3)

BUNDLED WITH
1.10.6
6 changes: 3 additions & 3 deletions flatcar.gemspec
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
require File.join([File.dirname(__FILE__),'lib','flatcar','version.rb'])

Gem::Specification.new do |gem|
gem.authors = %w(CenturyLink)
gem.email = %w([email protected])
gem.authors = %w(Michael Arnold, Laura Frank)
gem.email = %w([email protected])
gem.description = 'Flatcar is a command line tool to simplify the development of Ruby on Rails web applications that
are intended to be deployed and run in production as containerized Docker microservices.'
gem.summary = 'A CLI for Ruby on Rails web applications to be deployed as containerized Docker services'
gem.homepage = 'https://github.com/centurylinklabs/flatcar'
gem.homepage = 'https://github.com/flatcar/flatcar'
gem.license = 'Apache 2'
gem.platform = Gem::Platform::RUBY
gem.files = `git ls-files`.split($\)
Expand Down
17 changes: 3 additions & 14 deletions lib/flatcar/models/webapp_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,25 +43,14 @@ def service_link
end

def base_image_instruction
case @base_image
when 'alpine'
[
'FROM flatcar/alpine-rails'
].join("\n")
when 'ubuntu'
[
'FROM flatcar/ubuntu-rails'
].join("\n")
when 'debian'
[
'FROM flatcar/debian-rails'
].join("\n")
else
if @base_image == 'rails'
[
'FROM rails:latest',
'RUN apt-get update && apt-get install -y nodejs --no-install-recommends && rm -rf /var/lib/apt/lists/*',
'RUN apt-get update && apt-get install -y mysql-client postgresql-client sqlite3 --no-install-recommends && rm -rf /var/lib/apt/lists/*'
].join("\n")
else
"FROM flatcar/#{@base_image}-rails"
end
end
end
Expand Down
10 changes: 5 additions & 5 deletions spec/flatcar/models/webapp_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

it 'includes the ubuntu base image instructions' do
expect(subject.dockerfile).to eq([
'FROM centurylink/ubuntu-rails'
'FROM flatcar/ubuntu-rails'
].push(common_lines).join("\n"))
end
end
Expand All @@ -39,7 +39,7 @@

it 'includes the debian base image instructions' do
expect(subject.dockerfile).to eq([
'FROM centurylink/debian-rails'
'FROM flatcar/debian-rails'
].push(common_lines).join("\n"))
end
end
Expand All @@ -50,7 +50,7 @@

it 'includes the alpine base image instructions' do
expect(subject.dockerfile).to eq([
'FROM centurylink/alpine-rails',
'FROM flatcar/alpine-rails',
].push(common_lines).join("\n"))
end
end
Expand All @@ -62,7 +62,7 @@

it 'includes the alpine base image instructions with the postgres libraries' do
expect(subject.dockerfile).to eq([
'FROM centurylink/alpine-rails'
'FROM flatcar/alpine-rails'
].push(common_lines).join("\n"))
end
end
Expand All @@ -74,7 +74,7 @@

it 'includes the alpine base image instructions with the mysql libraries' do
expect(subject.dockerfile).to eq([
'FROM centurylink/alpine-rails'
'FROM flatcar/alpine-rails'
].push(common_lines).join("\n"))
end
end
Expand Down

0 comments on commit edca8a5

Please sign in to comment.