Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jleetutorial/dockerapp
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: linuxcat/dockerapp
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref

Commits on Oct 22, 2017

  1. local app copy file

    linuxcat committed Oct 22, 2017
    Copy the full SHA
    b4e1b2e View commit details
  2. compose fix

    linuxcat committed Oct 22, 2017
    Copy the full SHA
    b8fc92b View commit details
  3. compose fix

    linuxcat committed Oct 22, 2017
    Copy the full SHA
    aba6c5e View commit details
  4. compose fix

    linuxcat committed Oct 22, 2017
    Copy the full SHA
    fef44a0 View commit details
  5. compose fix

    linuxcat committed Oct 22, 2017
    Copy the full SHA
    f241135 View commit details
  6. compose fix

    linuxcat committed Oct 22, 2017
    Copy the full SHA
    a20f49a View commit details
  7. compose fix 2

    linuxcat committed Oct 22, 2017
    Copy the full SHA
    02ec016 View commit details
  8. without sudo

    linuxcat committed Oct 22, 2017
    Copy the full SHA
    715c7d8 View commit details
  9. fix to docker-compose file

    linuxcat committed Oct 22, 2017
    Copy the full SHA
    3901656 View commit details
  10. final commit

    linuxcat committed Oct 22, 2017
    Copy the full SHA
    cf354fb View commit details

Commits on Oct 23, 2017

  1. added dockerspec

    linuxcat committed Oct 23, 2017
    Copy the full SHA
    441dfa3 View commit details
  2. Copy the full SHA
    50eebbd View commit details
  3. bumping down ruby version

    linuxcat committed Oct 23, 2017
    Copy the full SHA
    7b0d527 View commit details
  4. just one

    linuxcat committed Oct 23, 2017
    Copy the full SHA
    71c2390 View commit details
  5. just one

    linuxcat committed Oct 23, 2017
    Copy the full SHA
    9fe2d37 View commit details
  6. Copy the full SHA
    2f46bbc View commit details
  7. upping wait for ci

    linuxcat committed Oct 23, 2017
    Copy the full SHA
    cfddbcf View commit details
  8. Copy the full SHA
    3d0e8b3 View commit details
  9. Copy the full SHA
    97eec55 View commit details
  10. add pre test step

    linuxcat committed Oct 23, 2017
    Copy the full SHA
    16d6d2c View commit details
  11. Copy the full SHA
    c222b31 View commit details
  12. upping ruby version

    linuxcat committed Oct 23, 2017
    Copy the full SHA
    bf89bce View commit details
  13. just trying rspec tests

    linuxcat committed Oct 23, 2017
    Copy the full SHA
    66c3d65 View commit details
  14. just trying rspec tests

    linuxcat committed Oct 23, 2017
    Copy the full SHA
    6d6e8f8 View commit details
  15. trying double quote

    linuxcat committed Oct 23, 2017
    Copy the full SHA
    2717762 View commit details
  16. trying double quote

    linuxcat committed Oct 23, 2017
    Copy the full SHA
    b5e704f View commit details
  17. trying double quote

    linuxcat committed Oct 23, 2017
    Copy the full SHA
    c88ad6d View commit details
  18. trying double quote

    linuxcat committed Oct 23, 2017
    Copy the full SHA
    c5ed536 View commit details
  19. trying double quote

    linuxcat committed Oct 23, 2017
    Copy the full SHA
    d754025 View commit details
  20. re=write of circle config

    linuxcat committed Oct 23, 2017
    Copy the full SHA
    8bbd431 View commit details
  21. re=write of circle config

    linuxcat committed Oct 23, 2017
    Copy the full SHA
    5518179 View commit details
  22. re=write of circle config

    linuxcat committed Oct 23, 2017
    Copy the full SHA
    8e3b9a7 View commit details
  23. re=write of circle config

    linuxcat committed Oct 23, 2017
    Copy the full SHA
    e660bcc View commit details
  24. re=write of circle config

    linuxcat committed Oct 23, 2017
    Copy the full SHA
    1fb0629 View commit details
  25. re=write of circle config

    linuxcat committed Oct 23, 2017
    Copy the full SHA
    c1d70d3 View commit details
  26. re=write of circle config

    linuxcat committed Oct 23, 2017
    Copy the full SHA
    b4c90ba View commit details
  27. re=write of circle config

    linuxcat committed Oct 23, 2017
    Copy the full SHA
    1dbdddc View commit details
  28. re=write of circle config

    linuxcat committed Oct 23, 2017
    Copy the full SHA
    3cef992 View commit details
  29. re=write of circle config

    linuxcat committed Oct 23, 2017
    Copy the full SHA
    a3800ea View commit details
  30. re=write of circle config

    linuxcat committed Oct 23, 2017
    Copy the full SHA
    3277293 View commit details
  31. re=write of circle config

    linuxcat committed Oct 23, 2017
    Copy the full SHA
    b831bb5 View commit details
  32. re=write of circle config

    linuxcat committed Oct 23, 2017
    Copy the full SHA
    c2ae360 View commit details
  33. re=write of circle config

    linuxcat committed Oct 23, 2017
    Copy the full SHA
    5d8803f View commit details
  34. final fix

    linuxcat committed Oct 23, 2017
    Copy the full SHA
    cc3722e View commit details
  35. Merge pull request #1 from linuxcat/docker_rspec

    Docker rspec
    linuxcat authored Oct 23, 2017
    Copy the full SHA
    1efb8ae View commit details
Showing with 162 additions and 2 deletions.
  1. +5 −0 .gitignore
  2. +1 −1 Dockerfile
  3. +9 −0 Gemfile
  4. +28 −0 Rakefile
  5. +38 −0 circle.yml
  6. +3 −1 docker-compose.yml
  7. +17 −0 spec/dockerapp/docker_compose_spec.rb
  8. +26 −0 spec/dockerapp/sample_spec.rb
  9. +35 −0 spec/spec_helper.rb
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
app/__pycache__/
*html*
*.lock
*.iml
.raketasks
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -4,4 +4,4 @@ RUN useradd -ms /bin/bash admin
USER admin
COPY app /app
WORKDIR /app
CMD ["python", "app.py"]
CMD ["python", "app.py"]
9 changes: 9 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
source 'https://rubygems.org'

gem 'serverspec', '~> 2.24'
gem 'docker-api'
gem 'rspec_html_formatter'
gem 'activesupport', '4.2.6'
gem 'dockerspec', '~> 0.5.0'
gem 'rspec-core', '< 3.6'

28 changes: 28 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
require 'rake'
require 'rspec/core/rake_task'

task :spec => 'spec:all'
task :default => :spec

namespace :spec do
targets = []
Dir.glob('./spec/*').each do |dir|
next unless File.directory?(dir)
target = File.basename(dir)
target = "_#{target}" if target == "default"
targets << target
end

task :all => targets
task :default => :all

targets.each do |target|
original_target = target == "_default" ? target[1..-1] : target
desc "Run serverspec tests to #{original_target}"
RSpec::Core::RakeTask.new(target.to_sym) do |t|
ENV['TARGET_HOST'] = original_target
t.pattern = "spec/#{original_target}/*_spec.rb"
t.rspec_opts ='--format RspecHtmlFormatter --format documentation --format html --out standard_report.html'
end
end
end
38 changes: 38 additions & 0 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
version: 2
jobs:
test:
docker:
- image: circleci/python:3.5
steps:
- checkout
- run:
name: Install Docker Compose
command: |
set -x
curl -L https://github.com/docker/compose/releases/download/1.11.2/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
# - run:
# name: Run Rspec Tests
# command: bundle exec rspec
- run:
name: Run Docker Compose
command: docker-compose up -d
- run:
name: Run Application Tests
command: docker-compose run dockerapp python test.py
workflows:
version: 2
test:
jobs:
- test

# deploy:
# hub:
# branch: /.*/
# commands:
# - docker login -e $DOCKER_HUB_EMAIL -u $DOCKER_HUB_USER_ID -p $DOCKER_HUB_PWD
# - docker tag dockerapp_dockerapp $DOCKER_HUB_USER_ID/dockerapp:$CIRCLE_SHA1
# - docker tag dockerapp_dockerapp $DOCKER_HUB_USER_ID/dockerapp:latest
# - docker push $DOCKER_HUB_USER_ID/dockerapp:$CIRCLE_SHA1
# - docker push $DOCKER_HUB_USER_ID/dockerapp:latest

4 changes: 3 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
version: "3.0"
version: '2'
services:
dockerapp:
build: .
ports:
- "5000:5000"
depends_on:
- redis
links:
- redis
redis:
image: redis:3.2.0
17 changes: 17 additions & 0 deletions spec/dockerapp/docker_compose_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
require 'dockerspec/serverspec'

describe docker_compose('docker-compose.yml', wait: 10) do

its_container(:redis) do
describe port(6379) do
it { should be_listening('tcp') }
end
end

its_container(:dockerapp) do
describe package('Flask') do
it { should be_installed.by('pip').with_version('0.11.1') }
end
end

end
26 changes: 26 additions & 0 deletions spec/dockerapp/sample_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# require 'spec_helper'
#
# describe "Dockerfile" do
# before(:all) do
# @image = Docker::Image.build_from_dir('../dockerapp')
#
# set :os, family: :redhat
# set :backend, :docker
# set :docker_image, @image.id
# end
#
# # describe package('Flask') do
# # it { should be_installed.by('pip').with_version('0.11.1')}
# # end
#
# describe user('admin') do
# it { should exist}
# it { should have_home_directory '/home/admin'}
# end
#
# describe file('/etc/hosts') do
# it { should be_file }
# end
#
# end

35 changes: 35 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
require 'serverspec'
require 'docker-api'
require 'net/ssh'

# set :backend, :ssh
#
# if ENV['ASK_SUDO_PASSWORD']
# begin
# require 'highline/import'
# rescue LoadError
# fail "highline is not available. Try installing it."
# end
# set :sudo_password, ask("Enter sudo password: ") { |q| q.echo = false }
# else
# set :sudo_password, ENV['SUDO_PASSWORD']
# end
#
# host = ENV['TARGET_HOST']
#
# options = Net::SSH::Config.for(host)
#
# options[:user] ||= Etc.getlogin
#
# set :host, options[:host_name] || host
# set :ssh_options, options

# Disable sudo
# set :disable_sudo, true


# Set environment variables
# set :env, :LANG => 'C', :LC_MESSAGES => 'C'

# Set PATH
# set :path, '/sbin:/usr/local/sbin:$PATH'