From 319b0c68585836a63f14ec1ccf13f4d25f35d3a1 Mon Sep 17 00:00:00 2001 From: Paul Czarkowski Date: Tue, 18 Nov 2014 17:16:41 -0600 Subject: [PATCH] use docker to build packages with docker on docker --- Dockerfile | 18 ++++++++++++++++++ README.md | 24 ++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..50f6cee --- /dev/null +++ b/Dockerfile @@ -0,0 +1,18 @@ +FROM python:2.7 + +RUN apt-get update && \ + apt-get -yqq install build-essential ruby-dev ruby git python-pip libxml2-dev libxslt-dev libffi-dev libmysqlclient-dev libpq-dev + +RUN gem install --no-ri --no-rdoc fpm + +ADD https://get.docker.com/builds/Linux/x86_64/docker-latest /usr/local/bin/docker + +RUN chmod +x /usr/local/bin/docker + +ADD . /giftwrap + +WORKDIR /giftwrap + +RUN python setup.py install + +CMD giftwrap build -m /tmp/manifest.yml diff --git a/README.md b/README.md index 156a717..8e053ca 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,28 @@ giftwrap is pretty simple. The basic flow is something like this: 8. giftwrap will check [devstack](https://devstack.org) for the system dependencies necessary for that project (to be done) 9. An [fpm](https://github.com/jordansissel/fpm) package will be built from the intersection of the python install and system dependencies +DockerDockerDockerDockerDocker +------------------------------ + +This shows how to use docker-in-docker to build packages really fast. the example shows doing it within the provided vagrant instance. but this is for illustration purposes, it should be runnable from any machine with docker installed. + + +Build a giftwrap docker container like this: + +``` +$ docker build -t bluebox/giftwrap . +``` + +Run the giftwrap docker image and map in your docker socket and your manifest file: + +``` +$ docker run --rm -v /var/run/docker.sock:/var/run/docker.sock -v /vagrant/sample.yml:/tmp/manifest.yml bluebox/giftwrap +$ docker images openstack-9.0 +REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE +openstack-9.0 bbc6 44c37c8d9672 10 minutes ago 499.5 MB + +``` + TODO ---- * Provide option for source removal; package only the executables @@ -74,9 +96,11 @@ License |:---------------------|:---------------------------------------------------| | **Authors** | John Dewey () | | | Craig Tracey () | +| | Paul Czarkowski () | | | | | **Copyright** | Copyright (c) 2014, John Dewey | | | Copyright (c) 2014, Craig Tracey | +| | Copyright (c) 2014, Paul Czarkowski | Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.