Pazuzu is a tool that builds Docker images from feature snippets, while resolving all dependencies between them. One of the common use cases is Continuous Integration environment, where jobs require specific tooling present for building and testing. Pazuzu can significantly ease that process, by letting user choose from a wide selection of predefined Dockerfile snippets that represent those dependencies (e.g. Golang, Python, Android SDK, customized NPM installs).
-
Make sure you setup Go according to: https://golang.org/doc/install#install
-
Clone Pazuzu repository:
git clone git@github.com:zalando-incubator/pazuzu.git $GOPATH/src/github.com/zalando-incubator/pazuzu
- Install govendor and go-swagger:
go get -u github.com/kardianos/govendor
go get -u github.com/go-swagger/go-swagger/cmd/swagger
- Sync vendor packages:
cd $GOPATH/src/github.com/zalando-incubator/pazuzu/
govendor sync
- Generate code from swagger.yaml:
cd $GOPATH/src/github.com/zalando-incubator/pazuzu/swagger
swagger generate client -f swagger.yaml
- Make sure that the tests are passing:
cd $GOPATH/src/github.com/zalando-incubator/pazuzu/
go get -t -v
go test -v ./...
- Build command-line utilities:
cd $GOPATH/src/github.com/zalando-incubator/pazuzu/cli/pazuzu
go build
- Install pazuzu command globally [Optional]:
go install
Basically, pazuzu CLI tool has 4 subcommands:
search
- search for available features inside the repositorycompose
- composePazuzufile
,Dockerfile
andtest.bats
files with desired featuresbuild
- create a Docker image based onDockerfile
config
- configure pazuzu tool
pazuzu search
is used to check which features are actually available in configured repository:
pazuzu search [regexp]
pazuzu search node
pazuzu search ja*
pazuzu compose
step creates Pazuzufile
, Dockerfile
and test.bats
for the specified set of features.
pazuzu compose -i node,java
If Pazuzufile
already exists in the directory, pazuzu compose
takes it as a base. If not, it generates
the new one based on the given features and default base image specified in the configuration.
-i
(or --init
) flag forces pazuzu to generate files with a new set of features.
-a
(or --add
) flag adds features to an existing set of features.
pazuzu compose -i node # initializes a Pazuzufile, Dockerfile and test.bats with Node.js feature
pazuzu compose -a java,lein # adds Java and Leiningen to an existing set of features
-d
(or --directory
) option sets the working directory to a specified path.
pazuzu compose -a node -d /tmp
In the given example, Node.js feature will be added to the list of features specified in /tmp/Pazuzufile
(if it exists) and the output files will be saved back to /tmp/
pazuzu build
is responsible for a final step - building and validating the Docker image.
pazuzu build -n hellodocker -d /tmp
-n
(or --name
) option sets the name for the created Docker image.
-d
(or --directory
) option sets the working directory where Dockerfile
is located.
pazuzu config
provides a set of tools to configure pazuzu CLI. Configurations are stored in ~/pazuzu-cli.yaml
.
pazuzu config list # lists all configurations
pazuzu config set registry.port 8080 # sets value of registy.port parameter
pazuzu confi get registy.port # gets value of registy.port parameter
Currenly pazuzu supports only registry as a storage.
See: Pazuzu Registry
Base image can be also set using pazuzu config
command.
pazuzu config set base ubuntu:16.04
- Switch on verbose mode using
-v/--verbose
:pazuzu -v compose -a node,npm
- Getting help message:
pazuzu help NAME: pazuzu - Build Docker features from pazuzu-registry ...
-
Check if Go is installed:
$ go version
-
Set up
$GOPATH
variable in your profile (e.g. to~/go
) -
Clone Pazuzu repository:
$ git clone git@github.com:zalando-incubator/pazuzu.git $GOPATH/src/github.com/zalando-incubator/pazuzu
-
Build command-line tools
$ cd $GOPATH/src/github.com/zalando-incubator/pazuzu/cli/pazuzu $ go build
-
Run tests
$ cd $GOPATH/src/github.com/zalando-incubator/pazuzu/cli/pazuzu $ go test ./...
The MIT License (MIT) Copyright © 2016 Zalando SE, https://tech.zalando.com
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.