summaryrefslogtreecommitdiff
path: root/packages/Dockerfile
diff options
context:
space:
mode:
authorSébastien Gross <seb•ɑƬ•chezwam•ɖɵʈ•org>2020-10-26 19:42:20 +0100
committerDavid Oberhollenzer <goliath@infraroot.at>2020-10-27 11:49:57 +0100
commit93d5f138025b09a4b1093001f33b9dc4c807603d (patch)
tree7f90a91f229a7ec254a9a8333f6b2bd5790983c6 /packages/Dockerfile
parent51c0c5694f6d8c752663f0a515f3b9e1cf081c66 (diff)
Build package using Docker images
Docker image can now be used to build packages for following distributions: * alpine * archlinux * centos * fedora * debian * ubuntu * opensuse Signed-off-by: Sébastien Gross <seb•ɑƬ•chezwam•ɖɵʈ•org>
Diffstat (limited to 'packages/Dockerfile')
-rw-r--r--packages/Dockerfile71
1 files changed, 71 insertions, 0 deletions
diff --git a/packages/Dockerfile b/packages/Dockerfile
new file mode 100644
index 0000000..5fadea9
--- /dev/null
+++ b/packages/Dockerfile
@@ -0,0 +1,71 @@
+# Dockerfile fo build a package for following Linux distributions:
+#
+#
+# * alpine
+# * archlinux
+# * centos
+# * fedora
+# * debian
+# * ubuntu
+# * opensuse
+#
+
+ARG vendor
+ARG release
+ARG version=1.0.2
+
+FROM $vendor:$release
+# Args are not globaly scoped
+ARG vendor
+ARG release
+ARG version=1.0.2
+
+# Install tools required to build a package for several distributions.
+#
+# Create a user and add it to sudoers.
+RUN case $vendor in \
+ alpine) \
+ apk add alpine-sdk sudo ;\
+ ;; \
+ archlinux) \
+ pacman -Sy; \
+ pacman -S --noconfirm fakeroot binutils namcap sudo ;\
+ ;; \
+ centos|fedora) \
+ yum install -y rpm-build spectool sudo ;\
+ ;; \
+ debian|ubuntu) \
+ apt-get update ;\
+ DEBIAN_FRONTEND=noninteractive apt-get install -y \
+ -o Dpkg::Options::=--force-confdef \
+ -o APT::Install-Recommends=no \
+ build-essential \
+ ca-certificates \
+ devscripts \
+ equivs \
+ libdistro-info-perl \
+ sudo \
+ wget \
+ ;\
+ ;; \
+ opensuse|opensuse/leap) \
+ zypper install -y rpm-build sudo wget ;\
+ ;; \
+ *) \
+ echo "Unsupported vendor '$vendor' (version: '$version')"; \
+ exit 1; \
+ ;; \
+ esac; \
+ case $vendor in \
+ alpine) adduser -G abuild -s /bin/ash -D builder ;; \
+ *) useradd -m -s /bin/sh builder ;; \
+ esac; \
+ echo 'builder ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/builder; \
+ chmod 0400 /etc/sudoers.d/builder
+
+USER builder
+WORKDIR /home/builder
+
+ENV vendor=$vendor
+ENV release=$release
+ENV version=$version