1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

add support for building first ARM debian package

Signed-off-by: Govinda Fichtner <govinda.fichtner@googlemail.com>
This commit is contained in:
Govinda Fichtner 2015-11-23 20:00:43 +01:00 committed by Stefan Scherer
parent 5ee4ad1d77
commit 7b31ed432e
30 changed files with 69 additions and 38 deletions

View file

@ -1,5 +0,0 @@
# `dockercore/builder-deb`
This image's tags contain the dependencies for building Docker `.deb`s for each of the Debian-based platforms Docker targets.
To add new tags, see [`contrib/builder/deb` in https://github.com/docker/docker](https://github.com/docker/docker/tree/master/contrib/builder/deb), specifically the `generate.sh` script, whose usage is described in a comment at the top of the file.

View file

@ -0,0 +1,5 @@
# `dockercore/builder-deb`
This image's tags contain the dependencies for building Docker `.deb`s for each of the Debian-based platforms Docker targets.
To add new tags, see [`contrib/builder/deb/amd64` in https://github.com/docker/docker](https://github.com/docker/docker/tree/master/contrib/builder/deb/amd64), specifically the `generate.sh` script, whose usage is described in a comment at the top of the file.

View file

@ -1,5 +1,5 @@
# #
# THIS FILE IS AUTOGENERATED; SEE "contrib/builder/deb/generate.sh"! # THIS FILE IS AUTOGENERATED; SEE "contrib/builder/deb/amd64/generate.sh"!
# #
FROM debian:jessie FROM debian:jessie

View file

@ -1,5 +1,5 @@
# #
# THIS FILE IS AUTOGENERATED; SEE "contrib/builder/deb/generate.sh"! # THIS FILE IS AUTOGENERATED; SEE "contrib/builder/deb/amd64/generate.sh"!
# #
FROM debian:stretch FROM debian:stretch

View file

@ -1,5 +1,5 @@
# #
# THIS FILE IS AUTOGENERATED; SEE "contrib/builder/deb/generate.sh"! # THIS FILE IS AUTOGENERATED; SEE "contrib/builder/deb/amd64/generate.sh"!
# #
FROM debian:wheezy-backports FROM debian:wheezy-backports

View file

@ -33,7 +33,7 @@ for version in "${versions[@]}"; do
echo "$version -> FROM $from" echo "$version -> FROM $from"
cat > "$version/Dockerfile" <<-EOF cat > "$version/Dockerfile" <<-EOF
# #
# THIS FILE IS AUTOGENERATED; SEE "contrib/builder/deb/generate.sh"! # THIS FILE IS AUTOGENERATED; SEE "contrib/builder/deb/amd64/generate.sh"!
# #
FROM $from FROM $from
@ -110,7 +110,7 @@ for version in "${versions[@]}"; do
echo >> "$version/Dockerfile" echo >> "$version/Dockerfile"
awk '$1 == "ENV" && $2 == "GO_VERSION" { print; exit }' ../../../Dockerfile >> "$version/Dockerfile" awk '$1 == "ENV" && $2 == "GO_VERSION" { print; exit }' ../../../../Dockerfile >> "$version/Dockerfile"
echo 'RUN curl -fSL "https://storage.googleapis.com/golang/go${GO_VERSION}.linux-amd64.tar.gz" | tar xzC /usr/local' >> "$version/Dockerfile" echo 'RUN curl -fSL "https://storage.googleapis.com/golang/go${GO_VERSION}.linux-amd64.tar.gz" | tar xzC /usr/local' >> "$version/Dockerfile"
echo 'ENV PATH $PATH:/usr/local/go/bin' >> "$version/Dockerfile" echo 'ENV PATH $PATH:/usr/local/go/bin' >> "$version/Dockerfile"

View file

@ -1,5 +1,5 @@
# #
# THIS FILE IS AUTOGENERATED; SEE "contrib/builder/deb/generate.sh"! # THIS FILE IS AUTOGENERATED; SEE "contrib/builder/deb/amd64/generate.sh"!
# #
FROM ubuntu:precise FROM ubuntu:precise

View file

@ -1,5 +1,5 @@
# #
# THIS FILE IS AUTOGENERATED; SEE "contrib/builder/deb/generate.sh"! # THIS FILE IS AUTOGENERATED; SEE "contrib/builder/deb/amd64/generate.sh"!
# #
FROM ubuntu:trusty FROM ubuntu:trusty

View file

@ -1,5 +1,5 @@
# #
# THIS FILE IS AUTOGENERATED; SEE "contrib/builder/deb/generate.sh"! # THIS FILE IS AUTOGENERATED; SEE "contrib/builder/deb/amd64/generate.sh"!
# #
FROM ubuntu:wily FROM ubuntu:wily

View file

@ -0,0 +1,10 @@
FROM armhf/debian:jessie
RUN apt-get update && apt-get install -y apparmor bash-completion btrfs-tools build-essential curl ca-certificates debhelper dh-apparmor dh-systemd git libapparmor-dev libdevmapper-dev libltdl-dev libsqlite3-dev libsystemd-journal-dev --no-install-recommends && rm -rf /var/lib/apt/lists/*
ENV GO_VERSION 1.4.3
RUN curl -fSL "https://github.com/hypriot/golang-armbuilds/releases/download/v${GO_VERSION}/go${GO_VERSION}.linux-armv7.tar.gz" | tar xzC /usr/local
ENV PATH $PATH:/usr/local/go/bin
ENV AUTO_GOPATH 1
ENV DOCKER_BUILDTAGS apparmor selinux

View file

@ -1,5 +0,0 @@
# `dockercore/builder-rpm`
This image's tags contain the dependencies for building Docker `.rpm`s for each of the RPM-based platforms Docker targets.
To add new tags, see [`contrib/builder/rpm` in https://github.com/docker/docker](https://github.com/docker/docker/tree/master/contrib/builder/rpm), specifically the `generate.sh` script, whose usage is described in a comment at the top of the file.

View file

@ -0,0 +1,5 @@
# `dockercore/builder-rpm`
This image's tags contain the dependencies for building Docker `.rpm`s for each of the RPM-based platforms Docker targets.
To add new tags, see [`contrib/builder/rpm/amd64` in https://github.com/docker/docker](https://github.com/docker/docker/tree/master/contrib/builder/rpm/amd64), specifically the `generate.sh` script, whose usage is described in a comment at the top of the file.

View file

@ -1,5 +1,5 @@
# #
# THIS FILE IS AUTOGENERATED; SEE "contrib/builder/rpm/generate.sh"! # THIS FILE IS AUTOGENERATED; SEE "contrib/builder/rpm/amd64/generate.sh"!
# #
FROM centos:7 FROM centos:7

View file

@ -1,5 +1,5 @@
# #
# THIS FILE IS AUTOGENERATED; SEE "contrib/builder/rpm/generate.sh"! # THIS FILE IS AUTOGENERATED; SEE "contrib/builder/rpm/amd64/generate.sh"!
# #
FROM fedora:22 FROM fedora:22

View file

@ -1,5 +1,5 @@
# #
# THIS FILE IS AUTOGENERATED; SEE "contrib/builder/rpm/generate.sh"! # THIS FILE IS AUTOGENERATED; SEE "contrib/builder/rpm/amd64/generate.sh"!
# #
FROM fedora:23 FROM fedora:23

View file

@ -30,7 +30,7 @@ for version in "${versions[@]}"; do
echo "$version -> FROM $from" echo "$version -> FROM $from"
cat > "$version/Dockerfile" <<-EOF cat > "$version/Dockerfile" <<-EOF
# #
# THIS FILE IS AUTOGENERATED; SEE "contrib/builder/rpm/generate.sh"! # THIS FILE IS AUTOGENERATED; SEE "contrib/builder/rpm/amd64/generate.sh"!
# #
FROM $from FROM $from
@ -161,7 +161,7 @@ for version in "${versions[@]}"; do
esac esac
awk '$1 == "ENV" && $2 == "GO_VERSION" { print; exit }' ../../../Dockerfile >> "$version/Dockerfile" awk '$1 == "ENV" && $2 == "GO_VERSION" { print; exit }' ../../../../Dockerfile >> "$version/Dockerfile"
echo 'RUN curl -fSL "https://storage.googleapis.com/golang/go${GO_VERSION}.linux-amd64.tar.gz" | tar xzC /usr/local' >> "$version/Dockerfile" echo 'RUN curl -fSL "https://storage.googleapis.com/golang/go${GO_VERSION}.linux-amd64.tar.gz" | tar xzC /usr/local' >> "$version/Dockerfile"
echo 'ENV PATH $PATH:/usr/local/go/bin' >> "$version/Dockerfile" echo 'ENV PATH $PATH:/usr/local/go/bin' >> "$version/Dockerfile"

View file

@ -1,5 +1,5 @@
# #
# THIS FILE IS AUTOGENERATED; SEE "contrib/builder/rpm/generate.sh"! # THIS FILE IS AUTOGENERATED; SEE "contrib/builder/rpm/amd64/generate.sh"!
# #
FROM opensuse:13.2 FROM opensuse:13.2

View file

@ -1,5 +1,5 @@
# #
# THIS FILE IS AUTOGENERATED; SEE "contrib/builder/rpm/generate.sh"! # THIS FILE IS AUTOGENERATED; SEE "contrib/builder/rpm/amd64/generate.sh"!
# #
FROM oraclelinux:7 FROM oraclelinux:7

View file

@ -5,7 +5,7 @@ cd "$(dirname "$BASH_SOURCE")/../.."
targets_from() { targets_from() {
git fetch -q https://github.com/docker/docker.git "$1" git fetch -q https://github.com/docker/docker.git "$1"
git ls-tree -r --name-only "$(git rev-parse FETCH_HEAD)" contrib/builder/deb | grep '/Dockerfile$' | sed -r 's!^contrib/builder/deb/|-debootstrap|/Dockerfile$!!g' git ls-tree -r --name-only "$(git rev-parse FETCH_HEAD)" contrib/builder/deb/ | grep '/Dockerfile$' | sed -r 's!^contrib/builder/deb/|^contrib/builder/deb/amd64/|-debootstrap|/Dockerfile$!!g' | grep -v /
} }
release_branch=$(git ls-remote --heads https://github.com/docker/docker.git | awk -F 'refs/heads/' '$2 ~ /^release/ { print $2 }' | sort -V | tail -1) release_branch=$(git ls-remote --heads https://github.com/docker/docker.git | awk -F 'refs/heads/' '$2 ~ /^release/ { print $2 }' | sort -V | tail -1)

View file

@ -17,7 +17,7 @@ Packager: Docker <support@docker.com>
%endif %endif
# required packages for build # required packages for build
# most are already in the container (see contrib/builder/rpm/generate.sh) # most are already in the container (see contrib/builder/rpm/ARCH/generate.sh)
# only require systemd on those systems # only require systemd on those systems
%if 0%{?is_systemd} %if 0%{?is_systemd}
BuildRequires: pkgconfig(systemd) BuildRequires: pkgconfig(systemd)

View file

@ -9,6 +9,7 @@ export DOCKER_ENGINE_OSARCH="$(docker version | awk '
')" ')"
export DOCKER_ENGINE_GOOS="${DOCKER_ENGINE_OSARCH%/*}" export DOCKER_ENGINE_GOOS="${DOCKER_ENGINE_OSARCH%/*}"
export DOCKER_ENGINE_GOARCH="${DOCKER_ENGINE_OSARCH##*/}" export DOCKER_ENGINE_GOARCH="${DOCKER_ENGINE_OSARCH##*/}"
DOCKER_ENGINE_GOARCH=${DOCKER_ENGINE_GOARCH:=amd64}
# and the client, just in case # and the client, just in case
export DOCKER_CLIENT_OSARCH="$(docker version | awk ' export DOCKER_CLIENT_OSARCH="$(docker version | awk '
@ -16,3 +17,18 @@ export DOCKER_CLIENT_OSARCH="$(docker version | awk '
$1 == "Server:" { client = 0; next } $1 == "Server:" { client = 0; next }
client && $1 == "OS/Arch:" { print $2 } client && $1 == "OS/Arch:" { print $2 }
')" ')"
# Retrieve the architecture used in contrib/builder/(deb|rpm)/$PACKAGE_ARCH/
PACKAGE_ARCH="amd64"
case "$DOCKER_ENGINE_OSARCH" in
linux/arm)
PACKAGE_ARCH='armhf'
;;
linux/ppc64le)
PACKAGE_ARCH='ppc64le'
;;
linux/s390x)
PACKAGE_ARCH='s390x'
;;
esac
export PACKAGE_ARCH

View file

@ -5,6 +5,7 @@ set -e
( (
export TZ=UTC # make sure our "date" variables are UTC-based export TZ=UTC # make sure our "date" variables are UTC-based
bundle .integration-daemon-start bundle .integration-daemon-start
bundle .detect-daemon-osarch
# TODO consider using frozen images for the dockercore/builder-deb tags # TODO consider using frozen images for the dockercore/builder-deb tags
@ -37,7 +38,7 @@ set -e
./man/md2man-all.sh -q || true ./man/md2man-all.sh -q || true
# TODO decide if it's worth getting go-md2man in _each_ builder environment to avoid this # TODO decide if it's worth getting go-md2man in _each_ builder environment to avoid this
builderDir="contrib/builder/deb" builderDir="contrib/builder/deb/${PACKAGE_ARCH}"
pkgs=( $(find "${builderDir}/"*/ -type d) ) pkgs=( $(find "${builderDir}/"*/ -type d) )
if [ ! -z "$DOCKER_BUILD_PKGS" ]; then if [ ! -z "$DOCKER_BUILD_PKGS" ]; then
pkgs=( $(echo ${DOCKER_BUILD_PKGS[@]/#/$builderDir\/}) ) pkgs=( $(echo ${DOCKER_BUILD_PKGS[@]/#/$builderDir\/}) )

View file

@ -6,6 +6,7 @@ set -e
export TZ=UTC # make sure our "date" variables are UTC-based export TZ=UTC # make sure our "date" variables are UTC-based
source "$(dirname "$BASH_SOURCE")/.integration-daemon-start" source "$(dirname "$BASH_SOURCE")/.integration-daemon-start"
source "$(dirname "$BASH_SOURCE")/.detect-daemon-osarch"
# TODO consider using frozen images for the dockercore/builder-rpm tags # TODO consider using frozen images for the dockercore/builder-rpm tags
@ -59,15 +60,15 @@ set -e
while read -r line || [[ -n "$line" ]]; do while read -r line || [[ -n "$line" ]]; do
if [ -z "$line" ]; then continue; fi if [ -z "$line" ]; then continue; fi
if [[ "$line" =~ $VERSION_REGEX ]]; then if [[ "$line" =~ $VERSION_REGEX ]]; then
echo >> contrib/builder/rpm/changelog echo >> contrib/builder/rpm/${PACKAGE_ARCH}/changelog
echo "* `date -d ${BASH_REMATCH[2]} '+%a %b %d %Y'` ${rpmPackager} - ${BASH_REMATCH[1]}" >> contrib/builder/rpm/changelog echo "* `date -d ${BASH_REMATCH[2]} '+%a %b %d %Y'` ${rpmPackager} - ${BASH_REMATCH[1]}" >> contrib/builder/rpm/${PACKAGE_ARCH}/changelog
fi fi
if [[ "$line" =~ $ENTRY_REGEX ]]; then if [[ "$line" =~ $ENTRY_REGEX ]]; then
echo "- ${BASH_REMATCH[1]//\`}" >> contrib/builder/rpm/changelog echo "- ${BASH_REMATCH[1]//\`}" >> contrib/builder/rpm/${PACKAGE_ARCH}/changelog
fi fi
done < CHANGELOG.md done < CHANGELOG.md
builderDir="contrib/builder/rpm" builderDir="contrib/builder/rpm/${PACKAGE_ARCH}"
pkgs=( $(find "${builderDir}/"*/ -type d) ) pkgs=( $(find "${builderDir}/"*/ -type d) )
if [ ! -z "$DOCKER_BUILD_PKGS" ]; then if [ ! -z "$DOCKER_BUILD_PKGS" ]; then
pkgs=( $(echo ${DOCKER_BUILD_PKGS[@]/#/$builderDir\/}) ) pkgs=( $(echo ${DOCKER_BUILD_PKGS[@]/#/$builderDir\/}) )
@ -97,7 +98,7 @@ set -e
RUN ln -sfv /usr/src/${rpmName}/hack/make/.build-rpm SPECS RUN ln -sfv /usr/src/${rpmName}/hack/make/.build-rpm SPECS
WORKDIR /root/rpmbuild/SPECS WORKDIR /root/rpmbuild/SPECS
RUN tar -cz -C /usr/src -f /root/rpmbuild/SOURCES/${rpmName}.tar.gz ${rpmName} RUN tar -cz -C /usr/src -f /root/rpmbuild/SOURCES/${rpmName}.tar.gz ${rpmName}
RUN { cat /usr/src/${rpmName}/contrib/builder/rpm/changelog; } >> ${rpmName}.spec && tail >&2 ${rpmName}.spec RUN { cat /usr/src/${rpmName}/contrib/builder/rpm/${PACKAGE_ARCH}/changelog; } >> ${rpmName}.spec && tail >&2 ${rpmName}.spec
RUN rpmbuild -ba \ RUN rpmbuild -ba \
--define '_release $rpmRelease' \ --define '_release $rpmRelease' \
--define '_version $rpmVersion' \ --define '_version $rpmVersion' \

View file

@ -93,7 +93,7 @@ if [ ! -f "$APTDIR/conf/docker-engine-release.conf" ]; then
fi fi
# release the debs # release the debs
for dir in contrib/builder/deb/*/; do for dir in contrib/builder/deb/${PACKAGE_ARCH}/*/; do
version="$(basename "$dir")" version="$(basename "$dir")"
codename="${version//debootstrap-}" codename="${version//debootstrap-}"
@ -122,7 +122,7 @@ apt-ftparchive clean "$APTDIR/conf/apt-ftparchive.conf"
# run the apt-ftparchive commands so we can have pinning # run the apt-ftparchive commands so we can have pinning
apt-ftparchive generate "$APTDIR/conf/apt-ftparchive.conf" apt-ftparchive generate "$APTDIR/conf/apt-ftparchive.conf"
for dir in contrib/builder/deb/*/; do for dir in contrib/builder/deb/${PACKAGE_ARCH}/*/; do
version="$(basename "$dir")" version="$(basename "$dir")"
codename="${version//debootstrap-}" codename="${version//debootstrap-}"

View file

@ -36,7 +36,7 @@ for distro in "${distros[@]}"; do
# Setup the yum repo # Setup the yum repo
REPO=$YUMDIR/$release/$distro REPO=$YUMDIR/$release/$distro
for dir in contrib/builder/rpm/$distro-*/; do for dir in contrib/builder/rpm/${PACKAGE_ARCH}/$distro-*/; do
version="$(basename "$dir")" version="$(basename "$dir")"
suite="${version##*-}" suite="${version##*-}"

View file

@ -12,7 +12,7 @@ fi
test_deb_install(){ test_deb_install(){
# test for each Dockerfile in contrib/builder # test for each Dockerfile in contrib/builder
for dir in contrib/builder/deb/*/; do for dir in contrib/builder/deb/${PACKAGE_ARCH}/*/; do
local from="$(awk 'toupper($1) == "FROM" { print $2; exit }' "$dir/Dockerfile")" local from="$(awk 'toupper($1) == "FROM" { print $2; exit }' "$dir/Dockerfile")"
local dir=$(basename "$dir") local dir=$(basename "$dir")

View file

@ -12,14 +12,17 @@ From the root of the Docker/Docker repo one can use make to execute the followin
- make validate - make validate
- make binary - make binary
- make build - make build
- make deb
- make bundles - make bundles
- make default - make default
- make shell - make shell
- make test-unit
- make test-integration-cli
- make - make
The Makefile does include logic to determine on which OS and architecture the Docker Development Image is built. The Makefile does include logic to determine on which OS and architecture the Docker Development Image is built.
Based on OS and architecture it chooses the correct Dockerfile. Based on OS and architecture it chooses the correct Dockerfile.
For the ARM 32bit architecture it uses `Dockerfile.arm`. For the ARM 32bit architecture it uses `Dockerfile.armhf`.
So for example in order to build a Docker binary one has to So for example in order to build a Docker binary one has to
1. clone the Docker/Docker repository on an ARM device `git clone git@github.com:docker/docker.git` 1. clone the Docker/Docker repository on an ARM device `git clone git@github.com:docker/docker.git`