Build a container specifically for building packages on Jenkins
A significant portion of our setup during builds is due to the apt-get calls
needed to build the docker container the way the Jenkins build scripts expect.
We can reduce some of that by building our own container and then using that
instead.
Change-Id: I824d3634db740976a6a2d9cdb33df0a53ba2e72b
diff --git a/mendel-builder/Dockerfile b/mendel-builder/Dockerfile
new file mode 100644
index 0000000..800328e
--- /dev/null
+++ b/mendel-builder/Dockerfile
@@ -0,0 +1,30 @@
+FROM debian:10-slim
+MAINTAINER coral-support@google.com
+
+RUN /bin/bash -c '\
+apt-get update && \
+apt-get install -y apt-transport-https apt-utils aptly aptly-publisher autoconf \
+ automake bc binfmt-support binutils-aarch64-linux-gnu \
+ build-essential ca-certificates cdbs coreutils cpio \
+ crossbuild-essential-arm64 crossbuild-essential-armhf curl \
+ debhelper debian-archive-keyring device-tree-compiler \
+ dh-python fakeroot gdisk genext2fs git gnome-pkg-tools gnupg \
+ gpg-agent kpartx libcap-dev libwayland-dev make mtools \
+ multistrap parted pbuilder pkg-config python python-minimal \
+ python2.7 python3 python3-all python3-apt python3-debian \
+ python3-git python3-pip python3-setuptools qemu-user-static \
+ quilt rsync sudo wget xz-utils zlib1g-dev \
+ && \
+apt-get clean'
+
+RUN /bin/bash -c '\
+curl https://storage.googleapis.com/git-repo-downloads/repo >/usr/local/bin/repo && \
+chmod a+x /usr/local/bin/repo'
+
+RUN /bin/bash -c 'git clone https://gerrit.googlesource.com/gcompute-tools /opt/gcompute-tools'
+
+ADD --chown=root:root aptly.conf /etc/aptly.conf
+ADD --chown=root:root gpg-agent.conf /etc/gpg-agent.conf
+
+VOLUME ['/var/lib/aptly', '/srv/aptly-publish-fs']
+WORKDIR /var/lib/aptly
diff --git a/mendel-builder/Makefile b/mendel-builder/Makefile
new file mode 100644
index 0000000..121b225
--- /dev/null
+++ b/mendel-builder/Makefile
@@ -0,0 +1,12 @@
+build: .build
+
+.build: Dockerfile Makefile aptly.conf
+ docker build -t gcr.io/mendel-linux-cloud-infra/mendel-builder:latest .
+ touch .build
+
+push: .push
+.push: .build
+ docker push gcr.io/mendel-linux-cloud-infra/mendel-builder:latest
+ touch .push
+
+.PHONY: build push
diff --git a/mendel-builder/aptly.conf b/mendel-builder/aptly.conf
new file mode 100644
index 0000000..02e88d9
--- /dev/null
+++ b/mendel-builder/aptly.conf
@@ -0,0 +1,3 @@
+{
+ "rootDir": "/var/lib/aptly"
+}
diff --git a/mendel-builder/gpg-agent.conf b/mendel-builder/gpg-agent.conf
new file mode 100644
index 0000000..f9fb847
--- /dev/null
+++ b/mendel-builder/gpg-agent.conf
@@ -0,0 +1 @@
+allow-preset-passphrase