summaryrefslogtreecommitdiff
path: root/Dockerfile
blob: 23eacb44773b1d9fc7002b265e6a12acffa052a6 (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
ARG UID="1000"
ARG GID="1000"
ARG ALPINE_VERSION="3.22"
FROM alpine:${ALPINE_VERSION}

# set environment
ARG ALPINE_VERSION
ARG UID
ARG GID

# add repos
RUN cat <<EOF > /etc/apk/repositories
http://dl-cdn.alpinelinux.org/alpine/v${ALPINE_VERSION}/main
http://dl-cdn.alpinelinux.org/alpine/v${ALPINE_VERSION}/community
EOF

# install packages
RUN apk -U add alpine-sdk doas
RUN echo "permit nopass :wheel" >> /etc/doas.d/doas.conf

# create build user
RUN <<EOF
getent group ${GID} || addgroup -g ${GID} builder
adduser -u ${UID} -G $(getent group ${GID} | cut -d: -f1) -D builder
adduser builder abuild
adduser builder wheel
EOF

# create scripts
RUN <<EOF
cat <<CAT > /bin/aports-build
#!/bin/sh
for port in \$APORTS; do
	cd "/aports/\$port"
	abuild -r
done
CAT
chmod +x /bin/aports-build

cat <<CAT > /bin/aports-keygen
#!/bin/sh
echo \$PACKAGER_PRIVKEY | abuild-keygen
CAT
chmod +x /bin/aports-keygen
EOF

# set user
USER builder