Rewrite for Podman based infrastructure
All checks were successful
/ build (push) Successful in 2m28s
All checks were successful
/ build (push) Successful in 2m28s
Replace Docker buildx based container building with buildah configured for running in a Forgejo runner that's inside a rootless Podman deployment. This also removes kubectl and ansible as my infrastructure is not going to target these technologies for deployment.
This commit is contained in:
parent
466c9ef7be
commit
402bc210aa
5 changed files with 112 additions and 142 deletions
62
builder.sh
Executable file
62
builder.sh
Executable file
|
@ -0,0 +1,62 @@
|
|||
#!/usr/bin/env bash
|
||||
set -xe
|
||||
|
||||
YQ_VERSION=v4.44.2
|
||||
NODE_VERSION=22.x
|
||||
PNPM_VERSION=v9.5.0
|
||||
|
||||
ctr=$(buildah from "docker.io/library/debian:trixie-20250428")
|
||||
mnt=$(buildah mount $ctr) # Used to verify mounts work
|
||||
|
||||
# Install dependencies
|
||||
buildah run $ctr -- apt-get update
|
||||
buildah run $ctr -- apt-get install -y --no-install-recommends \
|
||||
buildah \
|
||||
ca-certificates \
|
||||
containers-storage \
|
||||
crun \
|
||||
curl \
|
||||
git \
|
||||
netavark \
|
||||
openssh-client \
|
||||
podman \
|
||||
podman-docker \
|
||||
;
|
||||
|
||||
# Configure container storage
|
||||
shared=/var/lib/shared/storage
|
||||
buildah run $ctr -- sh -c "sed /usr/share/containers/storage.conf \
|
||||
-e '/^additionalimagestores/a"'\
|
||||
'" \"$shared\"' \
|
||||
> /etc/containers/storage.conf"
|
||||
buildah run $ctr -- sh -c "\
|
||||
mkdir -p $shared/overlay-images $shared/overlay-layers; \
|
||||
touch $shared/overlay-images/images.lock; \
|
||||
touch $shared/overlay-layers/layers.lock; \
|
||||
"
|
||||
|
||||
# yq https://github.com/mikefarah/yq?tab=readme-ov-file#install
|
||||
buildah run $ctr -- sh -c "curl --silent --location \"https://github.com/mikefarah/yq/releases/download/$YQ_VERSION/yq_linux_amd64.tar.gz\" \
|
||||
| tar --extract --gzip --to-stdout ./yq_linux_amd64 \
|
||||
| install --owner=root --group=root --mode=0755 /dev/stdin /usr/local/bin/yq \
|
||||
;"
|
||||
|
||||
# node https://github.com/nodesource/distributions?tab=readme-ov-file#using-debian-as-root-nodejs-22
|
||||
buildah run $ctr -- sh -c "curl --silent --location \"https://deb.nodesource.com/setup_$NODE_VERSION\" | bash"
|
||||
buildah run $ctr -- apt-get install -y --no-install-recommends nodejs
|
||||
|
||||
# pnpm https://nodejs.org/api/corepack.html#upgrading-the-global-versions
|
||||
buildah run $ctr -- corepack install --global pnpm@$PNPM_VERSION
|
||||
buildah run $ctr -- corepack enable pnpm
|
||||
|
||||
# Clear caches
|
||||
buildah run $ctr -- rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Config
|
||||
buildah config \
|
||||
--env BUILDAH_ISOLATION=chroot \
|
||||
--env _BUILDAH_STARTED_IN_USERNS= \
|
||||
$ctr;
|
||||
|
||||
buildah unmount $ctr
|
||||
buildah commit --rm $ctr $1
|
Loading…
Add table
Add a link
Reference in a new issue