blob: 5fadea974754cd998d1ca52017708f91a0deeb26 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
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
|