Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker builder #11

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions Dockerfile-jessie
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM multiarch/debian-debootstrap:armhf-jessie

ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update

# sensible-build.sh deps and deb packing debs
RUN apt-get install -y --no-install-recommends \
git ca-certificates wget patch \
build-essential debhelper dpkg-dev \
devscripts equivs

# build dpes
RUN apt-get install -y --no-install-recommends \
debhelper tcl8.6-dev autoconf python3-dev python3-venv libz-dev dh-systemd openssl

# runtime deps
RUN apt-get install -y --no-install-recommends \
net-tools iproute2 tclx8.4 tcl8.6 tcllib tcl-tls itcl3
18 changes: 18 additions & 0 deletions Dockerfile-stretch
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM multiarch/debian-debootstrap:armhf-stretch

ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update

# sensible-build.sh deps and deb packing debs
RUN apt-get install -y --no-install-recommends \
git ca-certificates wget patch \
build-essential debhelper dpkg-dev \
devscripts equivs

# build dpes
RUN apt-get install -y --no-install-recommends \
debhelper tcl8.6-dev autoconf python3-dev python3-venv libz-dev dh-systemd openssl

# runtime deps
RUN apt-get install -y --no-install-recommends \
net-tools iproute2 tclx8.4 tcl8.6 tcllib tcl-tls itcl3
18 changes: 18 additions & 0 deletions Dockerfile-wheezy
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM multiarch/debian-debootstrap:armhf-wheezy

ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update

# sensible-build.sh deps and deb packing debs
RUN apt-get install -y --no-install-recommends \
git ca-certificates wget patch \
build-essential debhelper dpkg-dev \
devscripts equivs

# build dpes
RUN apt-get install -y --no-install-recommends \
debhelper tcl8.5-dev autoconf python3-dev python-virtualenv libz-dev openssl

# runtime deps
RUN apt-get install -y --no-install-recommends \
net-tools iproute tclx8.4 tcl8.5 tcllib tcl-tls itcl3
36 changes: 36 additions & 0 deletions docker-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/env bash

set -o errexit # Exit on most errors (see the manual)
set -o errtrace # Make sure any error trap is inherited
set -o nounset # Disallow expansion of unset variables
set -o pipefail # Use last non-zero exit code in a pipeline
#set -o xtrace # Trace the execution of the script (debug)

DISTRIBUTION=${1}

DOCKER_IMAGE_NANE="piaware-builder:${DISTRIBUTION}"
DOCKER_CONTINAER_NANE="piaware-builder-${DISTRIBUTION}"

# build builder image
docker build --tag "${DOCKER_IMAGE_NANE}" --file "Dockerfile-${DISTRIBUTION}" .

# Setup the build env
mkdir -p "package-${DISTRIBUTION}"
docker run --rm -it --name "${DOCKER_CONTINAER_NANE}" \
-u="${UID}:$(id -g ${USER})" -v '/etc/group:/etc/group:ro' -v '/etc/passwd:/etc/passwd:ro' \
-v "${PWD}:/build:ro" \
-v "${PWD}/package-${DISTRIBUTION}:/build/package-${DISTRIBUTION}:rw" \
--workdir="/build" "${DOCKER_IMAGE_NANE}" \
./sensible-build.sh "${DISTRIBUTION}"

# build the deb packages
mkdir -p "debs-${DISTRIBUTION}"
docker run --rm -it --name "${DOCKER_CONTINAER_NANE}" \
-u="${UID}:$(id -g ${USER})" -v '/etc/group:/etc/group:ro' -v '/etc/passwd:/etc/passwd:ro' \
-v "${PWD}/debs-${DISTRIBUTION}:/build:rw" \
-v "${PWD}/package-${DISTRIBUTION}:/build/package-${DISTRIBUTION}:rw" \
--workdir="/build/package-${DISTRIBUTION}" \
"${DOCKER_IMAGE_NANE}" dpkg-buildpackage -b

rm -rf "package-${DISTRIBUTION}"
rm -rf "debs-${DISTRIBUTION}/package-${DISTRIBUTION}"