summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2021-09-16 17:33:38 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2021-09-25 14:15:22 +0200
commit6ebfbbb4f11c032f0c3fee3aab9cfb30ce717ea6 (patch)
tree0457dbf0eaf4aeeaa1b55437cd7778ce50ce781e
parent7835d1f007353883f5e4b7d75eaa6083dd5f1bc2 (diff)
downloadbootstrap-6ebfbbb4f11c032f0c3fee3aab9cfb30ce717ea6.tar
bootstrap-6ebfbbb4f11c032f0c3fee3aab9cfb30ce717ea6.zip
Add build helpers
l---------.containerignore1
-rw-r--r--.gitignore2
-rw-r--r--Containerfile19
-rw-r--r--Dockerfile12
-rwxr-xr-xbuild.sh15
5 files changed, 37 insertions, 12 deletions
diff --git a/.containerignore b/.containerignore
new file mode 120000
index 0000000..3e4e48b
--- /dev/null
+++ b/.containerignore
@@ -0,0 +1 @@
+.gitignore \ No newline at end of file
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..dbd0ce3
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+tmp
+rootfs.tar*
diff --git a/Containerfile b/Containerfile
new file mode 100644
index 0000000..194d727
--- /dev/null
+++ b/Containerfile
@@ -0,0 +1,19 @@
+FROM debian:11.0
+
+RUN \
+ apt-get update && \
+ DEBIAN_FRONTEND=noninteractive apt-get -y install \
+ make gcc g++ xz-utils \
+ libmpc-dev libmpfr-dev libgmp-dev zlib1g-dev \
+ python3-minimal gawk bison rsync \
+ && \
+ apt-get clean
+
+RUN mkdir /opt/sysroot
+
+RUN mkdir /build
+RUN useradd -U -u 1000 -d /build -M build
+RUN chown build:build /build
+
+USER build
+WORKDIR /build
diff --git a/Dockerfile b/Dockerfile
deleted file mode 100644
index 9bf9e08..0000000
--- a/Dockerfile
+++ /dev/null
@@ -1,12 +0,0 @@
-FROM debian:11.0
-
-RUN apt-get update && apt-get -y install build-essential && apt-get clean
-
-RUN mkdir /opt/sysroot
-
-RUN mkdir /build
-RUN useradd -U -u 1000 -d /build -M build
-RUN chown build:build /build
-
-USER build
-WORKDIR /build
diff --git a/build.sh b/build.sh
new file mode 100755
index 0000000..9ca49f0
--- /dev/null
+++ b/build.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+set -e
+
+cd "$(dirname "$0")"
+
+trap 'rm -rf tmp' EXIT
+rm -rf tmp
+
+buildah bud -t rebel-rootfs --squash
+buildah push rebel-rootfs dir:tmp
+buildah rmi rebel-rootfs
+
+digest="$(jq -r '.layers[0].digest' <tmp/manifest.json | cut -d: -f2)"
+mv -f "tmp/$digest" rootfs.tar.gz