diff options
Diffstat (limited to 'Dockerfile')
-rw-r--r-- | Dockerfile | 50 |
1 files changed, 46 insertions, 4 deletions
@@ -1,6 +1,48 @@ -FROM alpine +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 -RUN adduser -D user && adduser user abuild && adduser user wheel -USER user -CMD ["/bin/sh", "-c", "for port in /aports/*; do cd \"$port\" && abuild -r; done"] + +# 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 |