fpm-dockery 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +21 -15
- data/docker/Dockerfile.centos6 +45 -0
- data/docker/Dockerfile.centos7 +45 -0
- data/docker/Dockerfile.ubuntu15.04 +33 -0
- data/lib/fpm/dockery/cli.rb +24 -21
- data/lib/fpm/dockery/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 07381f13b35eb3f6a98665256001b2821d3c00cf
|
4
|
+
data.tar.gz: 003bb31babdf01f1745dfd52fa83d863eb6d3fc7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 60727d2485328174fa0d136978d59194a1578e64cda1142080e243e966e19cf616405106adb6916eedca45575584023ce0d28cdfd72d441db4f7f31c7d91c675
|
7
|
+
data.tar.gz: ca169f343ca419af204f8da74f54386882f4edefa0e300336d00206067896a11b26c23de42560ee0dd2ce61e9e310dc436c393d369e034a260f2820547882d33
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 0.1.8
|
4
|
+
|
5
|
+
* Added support for supplying extra Docker parameters to the build with `--docker-params`. [@randomvariable](https://github.com/randomvariable)
|
6
|
+
* Added support for Centos 6, Centos 7, Ubuntu 15.04. [@randomvariable](https://github.com/randomvariable)
|
7
|
+
|
3
8
|
## 0.1.7
|
4
9
|
|
5
10
|
* Add the ability to have a local cache dir. [@lloydpick](https://github.com/lloydpick)
|
data/README.md
CHANGED
@@ -4,9 +4,9 @@ Build [fpm-cookery](https://github.com/forward3d/fpm-cookery) recipes with Docke
|
|
4
4
|
|
5
5
|
## What is this?
|
6
6
|
|
7
|
-
This is a terribly-named wrapper around [fpm-cookery](https://github.com/forward3d/fpm-cookery)
|
8
|
-
that allows you to run fpm-cookery builds inside a container. I wrote this to allow me to run package builds
|
9
|
-
in development on my laptop in the same way that Jenkins runs them, and to allow easy building of packages
|
7
|
+
This is a terribly-named wrapper around [fpm-cookery](https://github.com/forward3d/fpm-cookery)
|
8
|
+
that allows you to run fpm-cookery builds inside a container. I wrote this to allow me to run package builds
|
9
|
+
in development on my laptop in the same way that Jenkins runs them, and to allow easy building of packages
|
10
10
|
for a variety of Linux distributions.
|
11
11
|
|
12
12
|
## Why would you use this?
|
@@ -15,9 +15,9 @@ If you are building your own operating system packages, you should be running th
|
|
15
15
|
environment every time. fpm-cookery is a superb tool for expressing the process of building and packaging
|
16
16
|
using fpm, but it provides no real functionality for working in a clean environment.
|
17
17
|
|
18
|
-
With the advent of [Docker](https://www.docker.com/), it is fast and easy to bring up an isolated
|
19
|
-
environment (a container) to perform the package building in. It also allows your CI server to perform
|
20
|
-
a very simple invocation to build packages (`fpm-dockery build recipe.rb ubuntu12.04`), and allows you
|
18
|
+
With the advent of [Docker](https://www.docker.com/), it is fast and easy to bring up an isolated
|
19
|
+
environment (a container) to perform the package building in. It also allows your CI server to perform
|
20
|
+
a very simple invocation to build packages (`fpm-dockery build recipe.rb ubuntu12.04`), and allows you
|
21
21
|
to run the same build on your development machine in the same way.
|
22
22
|
|
23
23
|
If a build fails, you can easily re-run the container and be dropped into the state where the build failed.
|
@@ -25,10 +25,10 @@ This makes it very easy to troubleshoot why a build is failing.
|
|
25
25
|
|
26
26
|
## How does it work?
|
27
27
|
|
28
|
-
`fpm-dockery` has the notion of 'builder' images. These are specially prepared Docker images that
|
28
|
+
`fpm-dockery` has the notion of 'builder' images. These are specially prepared Docker images that
|
29
29
|
contain enough tooling to get `fpm-cookery` working, along with `fpm-cookery` itself.
|
30
30
|
|
31
|
-
You can see the Dockerfiles used to generate these images in the
|
31
|
+
You can see the Dockerfiles used to generate these images in the
|
32
32
|
[`docker` directory](https://github.com/andytinycat/fpm-dockery/tree/master/docker) of this
|
33
33
|
repository.
|
34
34
|
|
@@ -70,16 +70,16 @@ Once you've installed it, you will have access to the `fpm-dockery` command line
|
|
70
70
|
$ bin/fpm-dockery --help
|
71
71
|
Usage:
|
72
72
|
fpm-dockery [OPTIONS] SUBCOMMAND [ARG] ...
|
73
|
-
|
73
|
+
|
74
74
|
Parameters:
|
75
75
|
SUBCOMMAND subcommand
|
76
76
|
[ARG] ... subcommand arguments
|
77
|
-
|
77
|
+
|
78
78
|
Subcommands:
|
79
79
|
create-builder-image Build one of the fpm-dockery Docker 'builder' images
|
80
80
|
package Run fpm-cookery in a Docker container to produce a package
|
81
81
|
list-builders List available builders
|
82
|
-
|
82
|
+
|
83
83
|
Options:
|
84
84
|
-h, --help print help
|
85
85
|
|
@@ -90,7 +90,7 @@ optional argument:
|
|
90
90
|
|
91
91
|
fpm-dockery package PATH_TO_RECIPE BUILDER [PACKAGE_DIR]
|
92
92
|
|
93
|
-
The builder is one of the supported builder images. If the builder image does not exist on the
|
93
|
+
The builder is one of the supported builder images. If the builder image does not exist on the
|
94
94
|
system where Docker is running, it will be automatically created first. The packages will be
|
95
95
|
created in `PATH_TO_RECIPE/pkg`.
|
96
96
|
|
@@ -103,7 +103,7 @@ argument `PACKAGE_DIR`:
|
|
103
103
|
|
104
104
|
fpm-dockery package example_recipe/recipe.rb ubuntu12.04 /tmp/somedir
|
105
105
|
|
106
|
-
If you're building a package from git source, and you're using a private repository
|
106
|
+
If you're building a package from git source, and you're using a private repository
|
107
107
|
(on GitHub or BitBucket or wherever), you can supply an SSH private key to build with.
|
108
108
|
The private key __must have no passphrase__. For reasons of security, it would be wise
|
109
109
|
to create a keypair just for your package builds, and give it only read access to the repository.
|
@@ -118,6 +118,12 @@ If you'd like to make fpm-cookery skip the packaging step, supply the `--skip-pa
|
|
118
118
|
|
119
119
|
fpm-dockery package --skip-package example_recipe/recipe.rb ubuntu12.04
|
120
120
|
|
121
|
+
If you'd like to supply more docker run parameters, for example environment variables, supply the `--docker-params` option:
|
122
|
+
|
123
|
+
fpm-dockery package --docker-params "-e PKG_VER=2.0" example_recipe/recipe.rb ubuntu12.04
|
124
|
+
|
125
|
+
|
126
|
+
|
121
127
|
### Viewing available builders
|
122
128
|
|
123
129
|
To see the available builders, run:
|
@@ -156,8 +162,8 @@ some unpleasant homegrown scripts at [Forward3D](https://github.com/forward3d),
|
|
156
162
|
|
157
163
|
## Acknowledgements
|
158
164
|
|
159
|
-
Thanks to [@bernd](https://github.com/bernd) for creating fpm-cookery, and [@sissel](https://github.com/jordansissel)
|
165
|
+
Thanks to [@bernd](https://github.com/bernd) for creating fpm-cookery, and [@sissel](https://github.com/jordansissel)
|
160
166
|
for creating FPM, without which life would be less pleasant.
|
161
167
|
|
162
|
-
I also used the Redis example recipe from @bernd's repository and placed it in this repository so it can be used
|
168
|
+
I also used the Redis example recipe from @bernd's repository and placed it in this repository so it can be used
|
163
169
|
for a quick proof-of-concept.
|
@@ -0,0 +1,45 @@
|
|
1
|
+
FROM centos:6
|
2
|
+
|
3
|
+
RUN yum -y update
|
4
|
+
|
5
|
+
# Additional tooling
|
6
|
+
RUN yum install -y git
|
7
|
+
RUN yum install -y curl
|
8
|
+
RUN yum install -y mercurial
|
9
|
+
RUN yum install -y subversion
|
10
|
+
RUN yum install -y unzip
|
11
|
+
RUN yum install -y tar
|
12
|
+
|
13
|
+
# Build tools
|
14
|
+
RUN yum install -y gcc
|
15
|
+
RUN yum install -y gcc-c++
|
16
|
+
RUN yum install -y glibc-devel
|
17
|
+
RUN yum install -y make
|
18
|
+
RUN yum install -y rpm-build
|
19
|
+
|
20
|
+
# Ruby dependencies
|
21
|
+
RUN yum install -y openssl-devel
|
22
|
+
RUN yum install -y readline-devel
|
23
|
+
RUN yum install -y zlib-devel
|
24
|
+
|
25
|
+
# Install Ruby via rbenv
|
26
|
+
RUN git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
|
27
|
+
RUN echo 'export PATH="/root/.rbenv/bin:$PATH"' >> /etc/profile.d/rbenv
|
28
|
+
ENV PATH /root/.rbenv/bin:$PATH
|
29
|
+
RUN git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
|
30
|
+
RUN source /etc/profile
|
31
|
+
RUN rbenv install 2.1.5
|
32
|
+
ENV PATH /root/.rbenv/versions/2.1.5/bin:$PATH
|
33
|
+
|
34
|
+
# Update rubygems and don't install docs
|
35
|
+
RUN gem update --system --verbose
|
36
|
+
RUN echo "gem: --no-document" >> ~/.gemrc
|
37
|
+
|
38
|
+
# Install fpm-cookery
|
39
|
+
RUN gem install fpm-cookery -v 0.27.0
|
40
|
+
|
41
|
+
# Remove strict host key checking for SSH
|
42
|
+
RUN echo 'StrictHostKeyChecking no' >> /etc/ssh/ssh_config
|
43
|
+
|
44
|
+
# Set an entry point to simplify command execution
|
45
|
+
ENTRYPOINT ["/root/.rbenv/versions/2.1.5/bin/fpm-cook"]
|
@@ -0,0 +1,45 @@
|
|
1
|
+
FROM centos:7
|
2
|
+
|
3
|
+
RUN yum -y update
|
4
|
+
|
5
|
+
# Additional tooling
|
6
|
+
RUN yum install -y git
|
7
|
+
RUN yum install -y curl
|
8
|
+
RUN yum install -y mercurial
|
9
|
+
RUN yum install -y subversion
|
10
|
+
RUN yum install -y unzip
|
11
|
+
RUN yum install -y tar
|
12
|
+
|
13
|
+
# Build tools
|
14
|
+
RUN yum install -y gcc
|
15
|
+
RUN yum install -y gcc-c++
|
16
|
+
RUN yum install -y glibc-devel
|
17
|
+
RUN yum install -y make
|
18
|
+
RUN yum install -y rpm-build
|
19
|
+
|
20
|
+
# Ruby dependencies
|
21
|
+
RUN yum install -y openssl-devel
|
22
|
+
RUN yum install -y readline-devel
|
23
|
+
RUN yum install -y zlib-devel
|
24
|
+
|
25
|
+
# Install Ruby via rbenv
|
26
|
+
RUN git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
|
27
|
+
RUN echo 'export PATH="/root/.rbenv/bin:$PATH"' >> /etc/profile.d/rbenv
|
28
|
+
ENV PATH /root/.rbenv/bin:$PATH
|
29
|
+
RUN git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
|
30
|
+
RUN source /etc/profile
|
31
|
+
RUN rbenv install 2.1.5
|
32
|
+
ENV PATH /root/.rbenv/versions/2.1.5/bin:$PATH
|
33
|
+
|
34
|
+
# Update rubygems and don't install docs
|
35
|
+
RUN gem update --system --verbose
|
36
|
+
RUN echo "gem: --no-document" >> ~/.gemrc
|
37
|
+
|
38
|
+
# Install fpm-cookery
|
39
|
+
RUN gem install fpm-cookery -v 0.27.0
|
40
|
+
|
41
|
+
# Remove strict host key checking for SSH
|
42
|
+
RUN echo 'StrictHostKeyChecking no' >> /etc/ssh/ssh_config
|
43
|
+
|
44
|
+
# Set an entry point to simplify command execution
|
45
|
+
ENTRYPOINT ["/root/.rbenv/versions/2.1.5/bin/fpm-cook"]
|
@@ -0,0 +1,33 @@
|
|
1
|
+
FROM ubuntu:15.04
|
2
|
+
|
3
|
+
RUN apt-get update
|
4
|
+
|
5
|
+
# Additional tooling
|
6
|
+
RUN apt-get install -y git
|
7
|
+
RUN apt-get install -y curl
|
8
|
+
RUN apt-get install -y mercurial
|
9
|
+
RUN apt-get install -y subversion
|
10
|
+
RUN apt-get install -y unzip
|
11
|
+
|
12
|
+
# Build tools
|
13
|
+
RUN apt-get install -y build-essential
|
14
|
+
|
15
|
+
# Install Ruby from Brightbox's PPA
|
16
|
+
RUN apt-get -y install software-properties-common
|
17
|
+
RUN apt-add-repository ppa:brightbox/ruby-ng
|
18
|
+
RUN apt-get update
|
19
|
+
RUN apt-get -y install ruby2.1
|
20
|
+
RUN apt-get -y install ruby2.1-dev
|
21
|
+
|
22
|
+
# Update rubygems and don't install docs
|
23
|
+
RUN gem update --system --verbose
|
24
|
+
RUN echo "gem: --no-document" >> ~/.gemrc
|
25
|
+
|
26
|
+
# Install fpm-cookery
|
27
|
+
RUN gem install fpm-cookery -v 0.27.0
|
28
|
+
|
29
|
+
# Remove strict host key checking for SSH
|
30
|
+
RUN echo 'StrictHostKeyChecking no' >> /etc/ssh/ssh_config
|
31
|
+
|
32
|
+
# Set an entry point to simplify command execution
|
33
|
+
ENTRYPOINT ["/usr/local/bin/fpm-cook"]
|
data/lib/fpm/dockery/cli.rb
CHANGED
@@ -3,17 +3,17 @@ require 'optparse'
|
|
3
3
|
module FPM
|
4
4
|
module Dockery
|
5
5
|
class CLI < Clamp::Command
|
6
|
-
|
6
|
+
|
7
7
|
class BaseCommand < Clamp::Command
|
8
8
|
include Logging
|
9
9
|
include Utils
|
10
|
-
|
10
|
+
|
11
11
|
# List all valid builders by listing the Dockerfile.* files in
|
12
12
|
# the docker directory.
|
13
13
|
def valid_builders
|
14
14
|
Dir.glob("#{FPM::Dockery.root}/docker/Dockerfile.*").map {|f| File.basename(f.gsub('Dockerfile.', ''))}
|
15
15
|
end
|
16
|
-
|
16
|
+
|
17
17
|
# Check the builder is one we have a Dockerfile for.
|
18
18
|
def validate_builder!
|
19
19
|
unless valid_builders.include?(builder)
|
@@ -21,7 +21,7 @@ module FPM
|
|
21
21
|
exit 1
|
22
22
|
end
|
23
23
|
end
|
24
|
-
|
24
|
+
|
25
25
|
# Create a builder image if it doesn't exist.
|
26
26
|
def create_builder_if_required
|
27
27
|
image_check = Subprocess.run("docker images | awk '{print $1}' | grep fpm-dockery/#{builder}")
|
@@ -30,7 +30,7 @@ module FPM
|
|
30
30
|
create_builder(false)
|
31
31
|
end
|
32
32
|
end
|
33
|
-
|
33
|
+
|
34
34
|
# Create a builder image.
|
35
35
|
def create_builder(no_cache)
|
36
36
|
validate_builder!
|
@@ -43,24 +43,24 @@ module FPM
|
|
43
43
|
exit exit_status.exitstatus
|
44
44
|
end
|
45
45
|
end
|
46
|
-
|
46
|
+
|
47
47
|
end
|
48
|
-
|
48
|
+
|
49
49
|
class ListBuildersCommand < BaseCommand
|
50
50
|
def execute
|
51
51
|
puts valid_builders.join("\n")
|
52
52
|
end
|
53
53
|
end
|
54
|
-
|
54
|
+
|
55
55
|
class CreateBuilderImage < BaseCommand
|
56
56
|
parameter "BUILDER", "Type of builder image to build"
|
57
57
|
option "--no-cache", :flag, "Build without cache"
|
58
|
-
|
58
|
+
|
59
59
|
def execute
|
60
60
|
create_builder(no_cache?)
|
61
61
|
end
|
62
62
|
end
|
63
|
-
|
63
|
+
|
64
64
|
# The package command implementation.
|
65
65
|
class PackageCommand < BaseCommand
|
66
66
|
parameter "RECIPE", "fpm-cookery recipe to build"
|
@@ -69,25 +69,28 @@ module FPM
|
|
69
69
|
option "--skip-package", :flag, "Skip package building (identical to fpm-cook --skip-package)"
|
70
70
|
option "--private-key", "PRIVATE_KEY", "Private key to use with SSH (for example, when cloning private Git repositories)"
|
71
71
|
option "--local-cache-dir", "DIR", "Local cache directory to use (useful if you are working with large source files)"
|
72
|
+
option "--docker-params", "DOCKER_PARAMS", "Extra Docker run parameters"
|
72
73
|
|
73
74
|
def execute
|
74
75
|
recipe_path = File.expand_path(recipe)
|
75
76
|
dir_to_mount = File.dirname(recipe_path)
|
76
77
|
name_of_recipe = File.basename(recipe_path)
|
77
|
-
|
78
|
+
|
78
79
|
validate_builder!
|
79
80
|
create_builder_if_required
|
80
|
-
|
81
|
+
|
81
82
|
extra_docker_commands = []
|
82
83
|
extra_fpm_cook_commands = []
|
83
|
-
|
84
|
+
|
84
85
|
pkg_dir = "/recipe/pkg"
|
85
|
-
|
86
|
+
|
86
87
|
if package_dir
|
87
88
|
extra_docker_commands << "-v #{File.expand_path(package_dir)}:/output"
|
88
89
|
pkg_dir = "/output"
|
89
90
|
end
|
90
|
-
|
91
|
+
|
92
|
+
extra_docker_commands << docker_params if docker_params
|
93
|
+
|
91
94
|
if private_key
|
92
95
|
begin
|
93
96
|
key = IO.read(File.expand_path(private_key))
|
@@ -109,7 +112,7 @@ module FPM
|
|
109
112
|
if skip_package?
|
110
113
|
extra_fpm_cook_commands << "--skip-package"
|
111
114
|
end
|
112
|
-
|
115
|
+
|
113
116
|
command = <<eos
|
114
117
|
docker run \
|
115
118
|
-v #{dir_to_mount}:/recipe \
|
@@ -130,13 +133,13 @@ eos
|
|
130
133
|
exit exit_status.exitstatus
|
131
134
|
end
|
132
135
|
end
|
133
|
-
|
136
|
+
|
134
137
|
end
|
135
|
-
|
136
|
-
subcommand "create-builder-image", "Build one of the fpm-dockery Docker 'builder' images", CreateBuilderImage
|
138
|
+
|
139
|
+
subcommand "create-builder-image", "Build one of the fpm-dockery Docker 'builder' images", CreateBuilderImage
|
137
140
|
subcommand "package", "Run fpm-cookery in a Docker container to produce a package", PackageCommand
|
138
141
|
subcommand "list-builders", "List available builders", ListBuildersCommand
|
139
|
-
|
142
|
+
|
140
143
|
end
|
141
144
|
end
|
142
|
-
end
|
145
|
+
end
|
data/lib/fpm/dockery/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fpm-dockery
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Sykes
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-09-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: clamp
|
@@ -70,8 +70,11 @@ files:
|
|
70
70
|
- README.md
|
71
71
|
- Rakefile
|
72
72
|
- bin/fpm-dockery
|
73
|
+
- docker/Dockerfile.centos6
|
74
|
+
- docker/Dockerfile.centos7
|
73
75
|
- docker/Dockerfile.ubuntu12.04
|
74
76
|
- docker/Dockerfile.ubuntu14.04
|
77
|
+
- docker/Dockerfile.ubuntu15.04
|
75
78
|
- example_recipe/recipe.rb
|
76
79
|
- example_recipe/redis-server.init.d
|
77
80
|
- fpm-dockery.gemspec
|