picsolve_docker_builder 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +2 -0
- data/.rubocop.yml +8 -0
- data/.travis.yml +3 -0
- data/Gemfile +4 -0
- data/README.md +25 -0
- data/Rakefile +80 -0
- data/bin/docker_build +5 -0
- data/integration/integration_play_spec.rb +51 -0
- data/integration/play_hello_world/.docker-builder.yml +3 -0
- data/integration/play_hello_world/.gitignore +12 -0
- data/integration/play_hello_world/Gemfile +2 -0
- data/integration/play_hello_world/LICENSE +8 -0
- data/integration/play_hello_world/README +4 -0
- data/integration/play_hello_world/Rakefile +3 -0
- data/integration/play_hello_world/app/controllers/Application.scala +12 -0
- data/integration/play_hello_world/app/views/index.scala.html +7 -0
- data/integration/play_hello_world/app/views/main.scala.html +15 -0
- data/integration/play_hello_world/build.sbt +20 -0
- data/integration/play_hello_world/conf/application.conf +44 -0
- data/integration/play_hello_world/conf/logback.xml +22 -0
- data/integration/play_hello_world/conf/routes +9 -0
- data/integration/play_hello_world/project/build.properties +4 -0
- data/integration/play_hello_world/project/plugins.sbt +16 -0
- data/integration/play_hello_world/public/images/favicon.png +0 -0
- data/integration/play_hello_world/public/javascripts/hello.js +3 -0
- data/integration/play_hello_world/public/stylesheets/main.css +0 -0
- data/integration/play_hello_world/test/ApplicationSpec.scala +30 -0
- data/integration/play_hello_world/test/IntegrationSpec.scala +24 -0
- data/integration/spec_helper.rb +3 -0
- data/lib/picsolve_docker_builder.rb +5 -0
- data/lib/picsolve_docker_builder/base.rb +66 -0
- data/lib/picsolve_docker_builder/builder/builder.rb +113 -0
- data/lib/picsolve_docker_builder/builder/file.rb +46 -0
- data/lib/picsolve_docker_builder/composer/composer.rb +134 -0
- data/lib/picsolve_docker_builder/composer/image.rb +68 -0
- data/lib/picsolve_docker_builder/composer/registry.rb +80 -0
- data/lib/picsolve_docker_builder/frame.rb +298 -0
- data/lib/picsolve_docker_builder/helpers/kubeclient.rb +34 -0
- data/lib/picsolve_docker_builder/helpers/kubernetes/pod.rb +38 -0
- data/lib/picsolve_docker_builder/helpers/kubernetes/rc.rb +98 -0
- data/lib/picsolve_docker_builder/helpers/kubernetes/resource.rb +28 -0
- data/lib/picsolve_docker_builder/helpers/kubernetes/service.rb +50 -0
- data/lib/picsolve_docker_builder/helpers/kubernetes_manager.rb +102 -0
- data/lib/picsolve_docker_builder/helpers/repository.rb +24 -0
- data/lib/picsolve_docker_builder/helpers/ssh_forward.rb +75 -0
- data/lib/picsolve_docker_builder/scala.rb +196 -0
- data/lib/picsolve_docker_builder/version.rb +4 -0
- data/lib/tasks/compose.rake +25 -0
- data/lib/tasks/docker.rake +24 -0
- data/lib/tasks/scala.rake +11 -0
- data/picsolve_docker_builder.gemspec +35 -0
- metadata +250 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 907102b94c2c0a9eb417a18a6c5641a9ac7cd765
|
4
|
+
data.tar.gz: 4e03d47cfcd191e7dc91c84dae78acd77ab5794e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 297c0d499002deea747be0506047a3d26fc5936bdcceeb50d9082a22ba3c84326c79cd113ed9fca81dab610ce45bff688021fb3264537fecf209d9fd13d423de
|
7
|
+
data.tar.gz: b9530741746f41ba865e552ec96dc6b7185bf5fb5e56747a15e30157c8b8ee4fe671eeef413463c8691911698e52e5f7d45c19687908f89dc56c165605ce7dbc
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# Picsolve Docker Builder
|
2
|
+
|
3
|
+
## Example config file `.docker-builder.yml`
|
4
|
+
|
5
|
+
```yaml
|
6
|
+
docker:
|
7
|
+
base_image: base-image-name
|
8
|
+
image_name: dest-image-name
|
9
|
+
dockerfile_hooks:
|
10
|
+
asset_build:
|
11
|
+
early: |
|
12
|
+
RUN touch /tmp/asset_build_earliest_time.txt
|
13
|
+
late: |
|
14
|
+
RUN touch /tmp/asset_build_latest_time.txt
|
15
|
+
docker_build:
|
16
|
+
early: |
|
17
|
+
RUN touch /tmp/docker_build_earliest_time.txt
|
18
|
+
late: |
|
19
|
+
RUN touch /tmp/docker_build_latest_time.txt
|
20
|
+
scala:
|
21
|
+
sbt:
|
22
|
+
build_task:
|
23
|
+
- clean
|
24
|
+
- universal:packageZipTarball
|
25
|
+
```
|
data/Rakefile
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/gem_tasks'
|
3
|
+
rescue LoadError
|
4
|
+
task :gem
|
5
|
+
end
|
6
|
+
|
7
|
+
begin
|
8
|
+
require 'rspec/core/rake_task'
|
9
|
+
RSpec::Core::RakeTask.new(:spec) do |task|
|
10
|
+
if @jenkins
|
11
|
+
task.rspec_opts = [
|
12
|
+
'--format', 'RspecJunitFormatter', '--out', 'target/rspec.xml',
|
13
|
+
'--format', 'documentation'
|
14
|
+
]
|
15
|
+
end
|
16
|
+
end
|
17
|
+
rescue LoadError
|
18
|
+
task :spec
|
19
|
+
end
|
20
|
+
|
21
|
+
begin
|
22
|
+
require 'rspec/core/rake_task'
|
23
|
+
RSpec::Core::RakeTask.new(:integration) do |task|
|
24
|
+
task.pattern = 'integration/**/*_spec.rb'
|
25
|
+
if @jenkins
|
26
|
+
task.rspec_opts = [
|
27
|
+
'--format', 'RspecJunitFormatter', '--out', 'target/integration.xml',
|
28
|
+
'--format', 'documentation'
|
29
|
+
]
|
30
|
+
end
|
31
|
+
end
|
32
|
+
rescue LoadError
|
33
|
+
task :integration
|
34
|
+
end
|
35
|
+
|
36
|
+
begin
|
37
|
+
require 'rubocop/rake_task'
|
38
|
+
RuboCop::RakeTask.new do |task|
|
39
|
+
if @jenkins
|
40
|
+
task.requires = [
|
41
|
+
'rubocop/formatter/checkstyle_formatter'
|
42
|
+
]
|
43
|
+
task.formatters = [
|
44
|
+
'simple',
|
45
|
+
'RuboCop::Formatter::CheckstyleFormatter'
|
46
|
+
]
|
47
|
+
task.options = %w(--out target/rubocop.xml)
|
48
|
+
task.fail_on_error = false
|
49
|
+
end
|
50
|
+
end
|
51
|
+
rescue LoadError
|
52
|
+
task :rubocop
|
53
|
+
end
|
54
|
+
|
55
|
+
desc 'Run all (quick) tests'
|
56
|
+
task test: [:spec, :rubocop]
|
57
|
+
|
58
|
+
desc 'Run all tests including long running integration tests'
|
59
|
+
task test_integration: [:test, :integration]
|
60
|
+
|
61
|
+
desc 'Run all tests for jenkins'
|
62
|
+
task :jenkins_prepare do
|
63
|
+
# cleanup target
|
64
|
+
FileUtils.rm_rf 'target'
|
65
|
+
FileUtils.mkdir 'target'
|
66
|
+
|
67
|
+
@jenkins = true
|
68
|
+
end
|
69
|
+
|
70
|
+
desc 'Run all quick tests from jenkins'
|
71
|
+
task jenkins: :jenkins_prepare do
|
72
|
+
Rake::Task[:test].invoke
|
73
|
+
end
|
74
|
+
|
75
|
+
desc 'Run all tests (including integration) from jenkins'
|
76
|
+
task jenkins_integration: :jenkins_prepare do
|
77
|
+
Rake::Task[:test_integration].invoke
|
78
|
+
end
|
79
|
+
|
80
|
+
task default: :test
|
data/bin/docker_build
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'picsolve_docker_builder/helpers/repository'
|
2
|
+
require 'docker'
|
3
|
+
require 'open3'
|
4
|
+
|
5
|
+
def sh(command)
|
6
|
+
env = {
|
7
|
+
'PATH' => ENV['PATH'],
|
8
|
+
'GEM_PATH' => ENV['GEM_PATH']
|
9
|
+
}
|
10
|
+
Open3.popen3(
|
11
|
+
env,
|
12
|
+
command,
|
13
|
+
unsetenv_others: true
|
14
|
+
) do |stdin, stdout, stderr, wait_thr|
|
15
|
+
stdin.close
|
16
|
+
stdout.each_line do |line|
|
17
|
+
$stdout.write(line)
|
18
|
+
$stdout.flush
|
19
|
+
end
|
20
|
+
stderr.each_line do |line|
|
21
|
+
$stderr.write(line)
|
22
|
+
$stderr.flush
|
23
|
+
end
|
24
|
+
exit_status = wait_thr.value
|
25
|
+
fail 'Exit code is not zero' if exit_status != 0
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
describe 'Integration tests' do
|
30
|
+
before(:each) do
|
31
|
+
begin
|
32
|
+
Docker.info.inspect
|
33
|
+
rescue Excon::Errors::Error
|
34
|
+
skip 'No docker daemon available'
|
35
|
+
end
|
36
|
+
end
|
37
|
+
describe 'docker build' do
|
38
|
+
describe 'play hello world' do
|
39
|
+
let :path do
|
40
|
+
'integration/play_hello_world'
|
41
|
+
end
|
42
|
+
it 'builds successfully' do
|
43
|
+
Dir.chdir(path) do
|
44
|
+
sh 'rm -f Gemfile.lock'
|
45
|
+
sh 'bundle install'
|
46
|
+
sh 'bundle exec rake docker:build'
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
This software is licensed under the Apache 2 license, quoted below.
|
2
|
+
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this project except in compliance with
|
4
|
+
the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
|
5
|
+
|
6
|
+
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
|
7
|
+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific
|
8
|
+
language governing permissions and limitations under the License.
|
@@ -0,0 +1,15 @@
|
|
1
|
+
@(title: String)(content: Html)
|
2
|
+
|
3
|
+
<!DOCTYPE html>
|
4
|
+
|
5
|
+
<html lang="en">
|
6
|
+
<head>
|
7
|
+
<title>@title</title>
|
8
|
+
<link rel="stylesheet" media="screen" href="@routes.Assets.versioned("stylesheets/main.css")">
|
9
|
+
<link rel="shortcut icon" type="image/png" href="@routes.Assets.versioned("images/favicon.png")">
|
10
|
+
<script src="@routes.Assets.versioned("javascripts/hello.js")" type="text/javascript"></script>
|
11
|
+
</head>
|
12
|
+
<body>
|
13
|
+
@content
|
14
|
+
</body>
|
15
|
+
</html>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
name := """play_hello_world"""
|
2
|
+
|
3
|
+
version := "1.0-SNAPSHOT"
|
4
|
+
|
5
|
+
lazy val root = (project in file(".")).enablePlugins(PlayScala)
|
6
|
+
|
7
|
+
scalaVersion := "2.11.6"
|
8
|
+
|
9
|
+
libraryDependencies ++= Seq(
|
10
|
+
jdbc,
|
11
|
+
cache,
|
12
|
+
ws,
|
13
|
+
specs2 % Test
|
14
|
+
)
|
15
|
+
|
16
|
+
resolvers += "scalaz-bintray" at "http://dl.bintray.com/scalaz/releases"
|
17
|
+
|
18
|
+
// Play provides two styles of routers, one expects its actions to be injected, the
|
19
|
+
// other, legacy style, accesses its actions statically.
|
20
|
+
routesGenerator := InjectedRoutesGenerator
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# This is the main configuration file for the application.
|
2
|
+
# ~~~~~
|
3
|
+
|
4
|
+
# Secret key
|
5
|
+
# ~~~~~
|
6
|
+
# The secret key is used to secure cryptographics functions.
|
7
|
+
#
|
8
|
+
# This must be changed for production, but we recommend not changing it in this file.
|
9
|
+
#
|
10
|
+
# See http://www.playframework.com/documentation/latest/ApplicationSecret for more details.
|
11
|
+
play.crypto.secret = "changeme"
|
12
|
+
|
13
|
+
# The application languages
|
14
|
+
# ~~~~~
|
15
|
+
play.i18n.langs = [ "en" ]
|
16
|
+
|
17
|
+
# Router
|
18
|
+
# ~~~~~
|
19
|
+
# Define the Router object to use for this application.
|
20
|
+
# This router will be looked up first when the application is starting up,
|
21
|
+
# so make sure this is the entry point.
|
22
|
+
# Furthermore, it's assumed your route file is named properly.
|
23
|
+
# So for an application router like `my.application.Router`,
|
24
|
+
# you may need to define a router file `conf/my.application.routes`.
|
25
|
+
# Default to Routes in the root package (and conf/routes)
|
26
|
+
# play.http.router = my.application.Routes
|
27
|
+
|
28
|
+
# Database configuration
|
29
|
+
# ~~~~~
|
30
|
+
# You can declare as many datasources as you want.
|
31
|
+
# By convention, the default datasource is named `default`
|
32
|
+
#
|
33
|
+
# db.default.driver=org.h2.Driver
|
34
|
+
# db.default.url="jdbc:h2:mem:play"
|
35
|
+
# db.default.user=sa
|
36
|
+
# db.default.password=""
|
37
|
+
|
38
|
+
# Evolutions
|
39
|
+
# ~~~~~
|
40
|
+
# You can disable evolutions if needed
|
41
|
+
# play.evolutions.enabled=false
|
42
|
+
|
43
|
+
# You can disable evolutions for a specific datasource if necessary
|
44
|
+
# play.evolutions.db.default.enabled=false
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<configuration>
|
2
|
+
|
3
|
+
<conversionRule conversionWord="coloredLevel" converterClass="play.api.Logger$ColoredLevel" />
|
4
|
+
|
5
|
+
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
6
|
+
<encoder>
|
7
|
+
<pattern>%coloredLevel - %logger - %message%n%xException</pattern>
|
8
|
+
</encoder>
|
9
|
+
</appender>
|
10
|
+
|
11
|
+
<!--
|
12
|
+
The logger name is typically the Java/Scala package name.
|
13
|
+
This configures the log level to log at for a package and its children packages.
|
14
|
+
-->
|
15
|
+
<logger name="play" level="INFO" />
|
16
|
+
<logger name="application" level="DEBUG" />
|
17
|
+
|
18
|
+
<root level="ERROR">
|
19
|
+
<appender-ref ref="STDOUT" />
|
20
|
+
</root>
|
21
|
+
|
22
|
+
</configuration>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# Routes
|
2
|
+
# This file defines all application routes (Higher priority routes first)
|
3
|
+
# ~~~~
|
4
|
+
|
5
|
+
# Home page
|
6
|
+
GET / controllers.Application.index
|
7
|
+
|
8
|
+
# Map static resources from the /public folder to the /assets URL path
|
9
|
+
GET /assets/*file controllers.Assets.versioned(path="/public", file: Asset)
|
@@ -0,0 +1,16 @@
|
|
1
|
+
// The Play plugin
|
2
|
+
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.4.1")
|
3
|
+
|
4
|
+
// web plugins
|
5
|
+
|
6
|
+
addSbtPlugin("com.typesafe.sbt" % "sbt-coffeescript" % "1.0.0")
|
7
|
+
|
8
|
+
addSbtPlugin("com.typesafe.sbt" % "sbt-less" % "1.0.6")
|
9
|
+
|
10
|
+
addSbtPlugin("com.typesafe.sbt" % "sbt-jshint" % "1.0.3")
|
11
|
+
|
12
|
+
addSbtPlugin("com.typesafe.sbt" % "sbt-rjs" % "1.0.7")
|
13
|
+
|
14
|
+
addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.1.0")
|
15
|
+
|
16
|
+
addSbtPlugin("com.typesafe.sbt" % "sbt-mocha" % "1.1.0")
|
Binary file
|
File without changes
|
@@ -0,0 +1,30 @@
|
|
1
|
+
import org.specs2.mutable._
|
2
|
+
import org.specs2.runner._
|
3
|
+
import org.junit.runner._
|
4
|
+
|
5
|
+
import play.api.test._
|
6
|
+
import play.api.test.Helpers._
|
7
|
+
|
8
|
+
/**
|
9
|
+
* Add your spec here.
|
10
|
+
* You can mock out a whole application including requests, plugins etc.
|
11
|
+
* For more information, consult the wiki.
|
12
|
+
*/
|
13
|
+
@RunWith(classOf[JUnitRunner])
|
14
|
+
class ApplicationSpec extends Specification {
|
15
|
+
|
16
|
+
"Application" should {
|
17
|
+
|
18
|
+
"send 404 on a bad request" in new WithApplication{
|
19
|
+
route(FakeRequest(GET, "/boum")) must beSome.which (status(_) == NOT_FOUND)
|
20
|
+
}
|
21
|
+
|
22
|
+
"render the index page" in new WithApplication{
|
23
|
+
val home = route(FakeRequest(GET, "/")).get
|
24
|
+
|
25
|
+
status(home) must equalTo(OK)
|
26
|
+
contentType(home) must beSome.which(_ == "text/html")
|
27
|
+
contentAsString(home) must contain ("Your new application is ready.")
|
28
|
+
}
|
29
|
+
}
|
30
|
+
}
|