aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Jonas Gunz <himself@jonasgunz.de> 2023-07-14 16:17:07 +0200
committerGravatar Jonas Gunz <himself@jonasgunz.de> 2023-07-14 16:17:07 +0200
commit7f698caa7cacdd1c8b2744cfa2cf49e05c66aed9 (patch)
tree1a34e24aea969b680a1d23dbe518dc767a656bf4
parent1bfc28926f4da9af6a783a4f0603c39f1627553f (diff)
downloadaurbuilder-7f698caa7cacdd1c8b2744cfa2cf49e05c66aed9.tar.gz
uding podman now
-rw-r--r--Readme.md17
-rwxr-xr-xbuild.sh8
-rw-r--r--docker/Dockerfile5
-rwxr-xr-xdocker/bin/buildpackage.sh11
-rwxr-xr-xtestrun.sh11
5 files changed, 39 insertions, 13 deletions
diff --git a/Readme.md b/Readme.md
index a4f820f..3dea85b 100644
--- a/Readme.md
+++ b/Readme.md
@@ -2,7 +2,22 @@
Docker base AUR Package builder for local arch repo
-Packages are put in `/srv/arch/`
+## Locations
+
+* Output, db and webroot `/srv/arch/`
+* Dockerfile and scripts for the Container ``
+* Scripts ``
+
+## nginx
+
+Config in `nginx.conf`
+
+```nginx
+# in http block
+
+include /etc/nginx/arch.conf;
+#include /etc/nginx/arch_ssl.conf;
+```
## Workflow
diff --git a/build.sh b/build.sh
index b399863..36f41b3 100755
--- a/build.sh
+++ b/build.sh
@@ -1,5 +1,7 @@
#!/bin/bash
-docker pull archlinux:base-devel
-#docker build --no-cache -t archpkg docker/
-docker build -t archpkg docker/
+DOCKER=podman
+
+$DOCKER pull archlinux:base-devel
+$DOCKER build --no-cache -t archpkg docker/
+#$DOCKER build -t archpkg docker/
diff --git a/docker/Dockerfile b/docker/Dockerfile
index f7b5e7f..9decea7 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -10,13 +10,16 @@ RUN pacman --noconfirm -Syu
RUN pacman --noconfirm -S git sudo
RUN groupadd sudo
-RUN useradd -G sudo -d /workdir -m aurbuilder
+RUN useradd --groups sudo --home-dir /workdir --create-home --user-group --system aurbuilder
COPY --chown=root:root sudoers /etc/sudoers
RUN mkdir /pkgout
VOLUME /pkgout
+RUN mkdir /pkgdest
+RUN chown aurbuilder:aurbuilder /pkgdest
+
RUN pacman --noconfirm -S python python-requests
RUN mkdir -p /opt/aurbuilder
diff --git a/docker/bin/buildpackage.sh b/docker/bin/buildpackage.sh
index ace52fd..a1dd8c3 100755
--- a/docker/bin/buildpackage.sh
+++ b/docker/bin/buildpackage.sh
@@ -3,6 +3,8 @@
echo "BUILDING: $PACKAGE_NAME"
echo "PACKAGER: $PACKAGER"
+INTERMED_DEST="/pkgdest"
+
cd /workdir || exit 1
while read -r NAME BASE VER _; do
@@ -15,12 +17,13 @@ while read -r NAME BASE VER _; do
continue
fi
- sudo -u aurbuilder git clone "https://aur.archlinux.org/$BASE.git" "$BASE"
+ sudo --user=aurbuilder \
+ git clone "https://aur.archlinux.org/$BASE.git" "$BASE"
cd "$BASE" || exit 1
- sudo -u aurbuilder CARCH="$ARCH" PACKAGER="$PACKAGER" PKGDEST="/pkgout/" \
+ sudo -u aurbuilder CARCH="$ARCH" PACKAGER="$PACKAGER" PKGDEST="$INTERMED_DEST" \
makepkg --force --syncdeps --noconfirm --install
- #cp ./*.pkg.tar.zst /pkgout
- test -n "$CHOWN" && sudo chown "$CHOWN" "/pkgout/${OUTNAME}"*
+ cp --no-preserve=ownership "$INTERMED_DEST/"*.pkg.tar.zst /pkgout
+ #test -n "$CHOWN" && sudo chown "$CHOWN" "/pkgout/${OUTNAME}"*
done <<< "$(getpackage.py "$PACKAGE_NAME")"
diff --git a/testrun.sh b/testrun.sh
index b8caf37..65fc722 100755
--- a/testrun.sh
+++ b/testrun.sh
@@ -1,15 +1,18 @@
#!/bin/bash
+DOCKER=podman
+
mkdir -p testrun/pkgout
CHOWN_TO="$USER"
OUTPUT="$(pwd)/testrun/pkgout"
-./build.sh
+#./build.sh
-docker run --name archpkg-test --env PACKAGE_NAME=minipro \
+#--userns=nomap
+$DOCKER run --userns=host --name archpkg-test --env PACKAGE_NAME=minipro \
--env FORCE_REBUILD=yes --env CHOWN="$(id -u "$CHOWN_TO"):$(id -g "$CHOWN_TO")" \
- -v "$OUTPUT:/pkgout" \
+ -v "$OUTPUT:/pkgout:z" \
archpkg
-docker rm archpkg-test
+$DOCKER rm archpkg-test