aboutsummaryrefslogtreecommitdiff
path: root/packages/Dockerfile
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-11-02 11:33:44 +0100
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-11-02 11:49:44 +0100
commit072890e9b0ec5af1b28b3c1b213554c5b16ab50e (patch)
tree2d5eeb6bd59601516c9e3d39c93aa932e95a2267 /packages/Dockerfile
parent7c4b2a289cab34e4ec1b966663530a7babf08707 (diff)
Backport changes to package scripts
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
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