mirror of
https://github.com/clearlinux/docker.git
synced 2026-08-19 04:07:34 +00:00
Add "builder-deb" base images for building ".deb" packages properly
Signed-off-by: Andrew "Tianon" Page <admwiggin@gmail.com>
This commit is contained in:
@@ -0,0 +1 @@
|
||||
9
|
||||
@@ -0,0 +1,27 @@
|
||||
Source: docker-core
|
||||
Maintainer: Docker <support@docker.com>
|
||||
Homepage: https://dockerproject.com
|
||||
Vcs-Browser: https://github.com/docker/docker
|
||||
Vcs-Git: git://github.com/docker/docker.git
|
||||
|
||||
Package: docker-core
|
||||
Architecture: linux-any
|
||||
Depends: iptables, ${misc:Depends}, ${perl:Depends}, ${shlibs:Depends}
|
||||
Recommends: aufs-tools,
|
||||
ca-certificates,
|
||||
cgroupfs-mount | cgroup-lite,
|
||||
git,
|
||||
xz-utils,
|
||||
${apparmor:Recommends}
|
||||
Conflicts: docker (<< 1.5~), docker.io, lxc-docker, lxc-docker-virtual-package
|
||||
Description: Docker: the open-source application container engine
|
||||
Docker is an open source project to pack, ship and run any application as a
|
||||
lightweight container
|
||||
.
|
||||
Docker containers are both hardware-agnostic and platform-agnostic. This means
|
||||
they can run anywhere, from your laptop to the largest EC2 compute instance and
|
||||
they can run anywhere, from your laptop to the largest EC2 compute instance and
|
||||
everything in between - and they don't require you to use a particular
|
||||
language, framework or packaging system. That makes them great building blocks
|
||||
for deploying and scaling web apps, databases, and backend services without
|
||||
depending on a particular stack or provider.
|
||||
@@ -0,0 +1 @@
|
||||
contrib/completion/bash/docker
|
||||
@@ -0,0 +1 @@
|
||||
../../../contrib/init/sysvinit-debian/docker.default
|
||||
@@ -0,0 +1 @@
|
||||
../../../contrib/init/sysvinit-debian/docker
|
||||
@@ -0,0 +1 @@
|
||||
../../../contrib/init/upstart/docker.conf
|
||||
@@ -0,0 +1,10 @@
|
||||
#contrib/syntax/vim/doc/* /usr/share/vim/vimfiles/doc/
|
||||
#contrib/syntax/vim/ftdetect/* /usr/share/vim/vimfiles/ftdetect/
|
||||
#contrib/syntax/vim/syntax/* /usr/share/vim/vimfiles/syntax/
|
||||
contrib/*-integration usr/share/docker-core/contrib/
|
||||
contrib/check-config.sh usr/share/docker-core/contrib/
|
||||
contrib/completion/zsh/_docker usr/share/zsh/vendor-completions/
|
||||
contrib/init/systemd/docker.service lib/systemd/system/
|
||||
contrib/init/systemd/docker.socket lib/systemd/system/
|
||||
contrib/mk* usr/share/docker-core/contrib/
|
||||
contrib/nuke-graph-directory.sh usr/share/docker-core/contrib/
|
||||
@@ -0,0 +1 @@
|
||||
docs/man/man*/*
|
||||
@@ -0,0 +1,20 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
case "$1" in
|
||||
configure)
|
||||
if [ -z "$2" ]; then
|
||||
if ! getent group docker > /dev/null; then
|
||||
groupadd --system docker
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
abort-*)
|
||||
# How'd we get here??
|
||||
exit 1
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
#DEBHELPER#
|
||||
+1
@@ -0,0 +1 @@
|
||||
../../../contrib/udev/80-docker.rules
|
||||
@@ -0,0 +1 @@
|
||||
README.md
|
||||
Executable
+36
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/make -f
|
||||
|
||||
VERSION = $(shell cat VERSION)
|
||||
|
||||
override_dh_gencontrol:
|
||||
# if we're on Ubuntu, we need to Recommends: apparmor
|
||||
echo 'apparmor:Recommends=$(shell dpkg-vendor --is Ubuntu && echo apparmor)' >> debian/docker-core.substvars
|
||||
dh_gencontrol
|
||||
|
||||
override_dh_auto_build:
|
||||
./hack/make.sh dynbinary
|
||||
# ./docs/man/md2man-all.sh runs outside the build container (if at all), since we don't have go-md2man here
|
||||
|
||||
override_dh_auto_test:
|
||||
./bundles/$(VERSION)/dynbinary/docker -v
|
||||
|
||||
override_dh_strip:
|
||||
# the SHA1 of dockerinit is important: don't strip it
|
||||
# also, Go has lots of problems with stripping, so just don't
|
||||
|
||||
override_dh_auto_install:
|
||||
mkdir -p debian/docker-core/usr/bin
|
||||
cp -aT "$$(readlink -f bundles/$(VERSION)/dynbinary/docker)" debian/docker-core/usr/bin/docker
|
||||
mkdir -p debian/docker-core/usr/libexec/docker
|
||||
cp -aT "$$(readlink -f bundles/$(VERSION)/dynbinary/dockerinit)" debian/docker-core/usr/libexec/docker/dockerinit
|
||||
|
||||
override_dh_installinit:
|
||||
# use "docker" as our service name, not "docker-core"
|
||||
dh_installinit --name=docker
|
||||
|
||||
override_dh_installudev:
|
||||
# match our existing priority
|
||||
dh_installudev --priority=z80
|
||||
|
||||
%:
|
||||
dh $@ --with=systemd,bash-completion
|
||||
@@ -0,0 +1,82 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
DEST=$1
|
||||
|
||||
# subshell so that we can export PATH without breaking other things
|
||||
(
|
||||
source "$(dirname "$BASH_SOURCE")/.integration-daemon-start"
|
||||
|
||||
# we need to wrap up everything in between integration-daemon-start and
|
||||
# integration-daemon-stop to make sure we kill the daemon and don't hang,
|
||||
# even and especially on test failures
|
||||
didFail=
|
||||
if ! {
|
||||
set -e
|
||||
|
||||
# TODO consider using frozen images for the dockercore/builder-deb tags
|
||||
|
||||
debVersion="${VERSION//-/'~'}"
|
||||
# if we have a "-dev" suffix or have change in Git, let's make this package version more complex so it works better
|
||||
if [[ "$VERSION" == *-dev ]] || [ -n "$(git status --porcelain)" ]; then
|
||||
gitUnix="$(git log -1 --pretty='%at')"
|
||||
gitDate="$(date --date "@$gitUnix" +'%Y%m%d.%H%M%S')"
|
||||
gitCommit="$(git log -1 --pretty='%h')"
|
||||
gitVersion="git${gitDate}.0.${gitCommit}"
|
||||
# gitVersion is now something like 'git20150128.112847.0.17e840a'
|
||||
debVersion="$debVersion~$gitVersion"
|
||||
|
||||
# $ dpkg --compare-versions 1.5.0 gt 1.5.0~rc1 && echo true || echo false
|
||||
# true
|
||||
# $ dpkg --compare-versions 1.5.0~rc1 gt 1.5.0~git20150128.112847.17e840a && echo true || echo false
|
||||
# true
|
||||
# $ dpkg --compare-versions 1.5.0~git20150128.112847.17e840a gt 1.5.0~dev~git20150128.112847.17e840a && echo true || echo false
|
||||
# true
|
||||
|
||||
# ie, 1.5.0 > 1.5.0~rc1 > 1.5.0~git20150128.112847.17e840a > 1.5.0~dev~git20150128.112847.17e840a
|
||||
fi
|
||||
|
||||
debSource="$(awk -F ': ' '$1 == "Source" { print $2; exit }' hack/make/.build-deb/control)"
|
||||
debMaintainer="$(awk -F ': ' '$1 == "Maintainer" { print $2; exit }' hack/make/.build-deb/control)"
|
||||
debDate="$(date --rfc-2822)"
|
||||
|
||||
# if go-md2man is available, pre-generate the man pages
|
||||
./docs/man/md2man-all.sh -q || true
|
||||
# TODO decide if it's worth getting go-md2man in _each_ builder environment to avoid this
|
||||
|
||||
# TODO add a configurable knob for _which_ debs to build so we don't have to modify the file or build all of them every time we need to test
|
||||
for dir in contrib/builder/deb/*/; do
|
||||
version="$(basename "$dir")"
|
||||
suite="${version##*-}"
|
||||
|
||||
image="dockercore/builder-deb:$version"
|
||||
if ! docker inspect "$image" &> /dev/null; then
|
||||
( set -x && docker build -t "$image" "$dir" )
|
||||
fi
|
||||
|
||||
mkdir -p "$DEST/$version"
|
||||
cat > "$DEST/$version/Dockerfile.build" <<-EOF
|
||||
FROM $image
|
||||
WORKDIR /usr/src/docker
|
||||
COPY . /usr/src/docker
|
||||
RUN ln -sfv hack/make/.build-deb debian
|
||||
RUN { echo '$debSource (${debVersion}-0~${suite}) $suite; urgency=low'; echo; echo ' * Version: $VERSION'; echo; echo " -- $debMaintainer $debDate"; } > debian/changelog && cat >&2 debian/changelog
|
||||
RUN dpkg-buildpackage -uc -us
|
||||
EOF
|
||||
cp -a "$DEST/$version/Dockerfile.build" . # can't use $DEST because it's in .dockerignore...
|
||||
tempImage="docker-temp/build-deb:$version"
|
||||
( set -x && docker build -t "$tempImage" -f Dockerfile.build . )
|
||||
docker run --rm "$tempImage" bash -c 'cd .. && tar -c *_*' | tar -xvC "$DEST/$version"
|
||||
docker rmi "$tempImage"
|
||||
done
|
||||
}; then
|
||||
didFail=1
|
||||
fi
|
||||
|
||||
# clean up after ourselves
|
||||
rm -f Dockerfile.build
|
||||
|
||||
source "$(dirname "$BASH_SOURCE")/.integration-daemon-stop"
|
||||
|
||||
[ -z "$didFail" ] # "set -e" ftw
|
||||
) 2>&1 | tee -a $DEST/test.log
|
||||
Reference in New Issue
Block a user