From 93d5f138025b09a4b1093001f33b9dc4c807603d Mon Sep 17 00:00:00 2001 From: Sébastien Gross Date: Mon, 26 Oct 2020 19:42:20 +0100 Subject: Build package using Docker images MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- packages/Dockerfile | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 packages/Dockerfile (limited to 'packages/Dockerfile') 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 -- cgit v1.2.3