Skip to content

Commit

Permalink
add support for building first ARM debian package
Browse files Browse the repository at this point in the history
Signed-off-by: Govinda Fichtner <govinda.fichtner@googlemail.com>
  • Loading branch information
Govinda-Fichtner authored and StefanScherer committed Jan 28, 2016
1 parent 5ee4ad1 commit 7b31ed4
Show file tree
Hide file tree
Showing 30 changed files with 69 additions and 38 deletions.
5 changes: 0 additions & 5 deletions contrib/builder/deb/README.md

This file was deleted.

5 changes: 5 additions & 0 deletions contrib/builder/deb/amd64/README.md
Original file line number Diff line number Diff line change
@@ -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.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ for version in "${versions[@]}"; do
echo "$version -> FROM $from"
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
Expand Down Expand Up @@ -110,7 +110,7 @@ for version in "${versions[@]}"; do

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 'ENV PATH $PATH:/usr/local/go/bin' >> "$version/Dockerfile"

Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
10 changes: 10 additions & 0 deletions contrib/builder/deb/armhf/debian-jessie/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
5 changes: 0 additions & 5 deletions contrib/builder/rpm/README.md

This file was deleted.

5 changes: 5 additions & 0 deletions contrib/builder/rpm/amd64/README.md
Original file line number Diff line number Diff line change
@@ -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.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ for version in "${versions[@]}"; do
echo "$version -> FROM $from"
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
Expand Down Expand Up @@ -161,7 +161,7 @@ for version in "${versions[@]}"; do
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 'ENV PATH $PATH:/usr/local/go/bin' >> "$version/Dockerfile"

Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion contrib/reprepro/suites.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ cd "$(dirname "$BASH_SOURCE")/../.."

targets_from() {
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)
Expand Down
2 changes: 1 addition & 1 deletion hack/make/.build-rpm/docker-engine.spec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Packager: Docker <support@docker.com>
%endif

# 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
%if 0%{?is_systemd}
BuildRequires: pkgconfig(systemd)
Expand Down
16 changes: 16 additions & 0 deletions hack/make/.detect-daemon-osarch
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,26 @@ export DOCKER_ENGINE_OSARCH="$(docker version | awk '
')"
export DOCKER_ENGINE_GOOS="${DOCKER_ENGINE_OSARCH%/*}"
export DOCKER_ENGINE_GOARCH="${DOCKER_ENGINE_OSARCH##*/}"
DOCKER_ENGINE_GOARCH=${DOCKER_ENGINE_GOARCH:=amd64}

# and the client, just in case
export DOCKER_CLIENT_OSARCH="$(docker version | awk '
$1 == "Client:" { client = 1; next }
$1 == "Server:" { client = 0; next }
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
3 changes: 2 additions & 1 deletion hack/make/build-deb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ set -e
(
export TZ=UTC # make sure our "date" variables are UTC-based
bundle .integration-daemon-start
bundle .detect-daemon-osarch

# TODO consider using frozen images for the dockercore/builder-deb tags

Expand Down Expand Up @@ -37,7 +38,7 @@ set -e
./man/md2man-all.sh -q || true
# 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) )
if [ ! -z "$DOCKER_BUILD_PKGS" ]; then
pkgs=( $(echo ${DOCKER_BUILD_PKGS[@]/#/$builderDir\/}) )
Expand Down
11 changes: 6 additions & 5 deletions hack/make/build-rpm
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ set -e
export TZ=UTC # make sure our "date" variables are UTC-based

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

Expand Down Expand Up @@ -59,15 +60,15 @@ set -e
while read -r line || [[ -n "$line" ]]; do
if [ -z "$line" ]; then continue; fi
if [[ "$line" =~ $VERSION_REGEX ]]; then
echo >> contrib/builder/rpm/changelog
echo "* `date -d ${BASH_REMATCH[2]} '+%a %b %d %Y'` ${rpmPackager} - ${BASH_REMATCH[1]}" >> 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/${PACKAGE_ARCH}/changelog
fi
if [[ "$line" =~ $ENTRY_REGEX ]]; then
echo "- ${BASH_REMATCH[1]//\`}" >> contrib/builder/rpm/changelog
echo "- ${BASH_REMATCH[1]//\`}" >> contrib/builder/rpm/${PACKAGE_ARCH}/changelog
fi
done < CHANGELOG.md

builderDir="contrib/builder/rpm"
builderDir="contrib/builder/rpm/${PACKAGE_ARCH}"
pkgs=( $(find "${builderDir}/"*/ -type d) )
if [ ! -z "$DOCKER_BUILD_PKGS" ]; then
pkgs=( $(echo ${DOCKER_BUILD_PKGS[@]/#/$builderDir\/}) )
Expand Down Expand Up @@ -97,7 +98,7 @@ set -e
RUN ln -sfv /usr/src/${rpmName}/hack/make/.build-rpm SPECS
WORKDIR /root/rpmbuild/SPECS
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 \
--define '_release $rpmRelease' \
--define '_version $rpmVersion' \
Expand Down
4 changes: 2 additions & 2 deletions hack/make/release-deb
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ if [ ! -f "$APTDIR/conf/docker-engine-release.conf" ]; then
fi

# release the debs
for dir in contrib/builder/deb/*/; do
for dir in contrib/builder/deb/${PACKAGE_ARCH}/*/; do
version="$(basename "$dir")"
codename="${version//debootstrap-}"

Expand Down Expand Up @@ -122,7 +122,7 @@ apt-ftparchive clean "$APTDIR/conf/apt-ftparchive.conf"
# run the apt-ftparchive commands so we can have pinning
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")"
codename="${version//debootstrap-}"

Expand Down
2 changes: 1 addition & 1 deletion hack/make/release-rpm
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ for distro in "${distros[@]}"; do
# Setup the yum repo
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")"
suite="${version##*-}"

Expand Down
2 changes: 1 addition & 1 deletion hack/make/test-deb-install
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ fi

test_deb_install(){
# 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 dir=$(basename "$dir")

Expand Down
5 changes: 4 additions & 1 deletion project/ARM.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,17 @@ From the root of the Docker/Docker repo one can use make to execute the followin
- make validate
- make binary
- make build
- make deb
- make bundles
- make default
- make shell
- make test-unit
- make test-integration-cli
- make

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.
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
1. clone the Docker/Docker repository on an ARM device `git clone git@github.com:docker/docker.git`
Expand Down

0 comments on commit 7b31ed4

Please sign in to comment.