builder/builder.sh

60 lines
1.8 KiB
Bash
Raw Normal View History

2025-05-16 17:42:27 +02:00
#!/usr/bin/env bash
2025-05-17 23:09:38 +02:00
set -xe
2025-05-16 17:42:27 +02:00
YQ_VERSION=v4.44.2
NODE_VERSION=22.x
2025-05-17 23:09:38 +02:00
PNPM_VERSION=v9.5.0
2025-05-16 17:42:27 +02:00
ctr=$(buildah from "docker.io/library/debian:trixie-20250428")
2025-05-17 23:41:22 +02:00
mnt=$(buildah mount $ctr)
2025-05-16 17:42:27 +02:00
2025-05-17 22:18:27 +02:00
buildah run $ctr -- apt-get update
2025-05-17 21:31:54 +02:00
buildah run $ctr -- apt-get install -y --no-install-recommends \
2025-05-16 17:42:27 +02:00
buildah \
2025-05-17 21:23:19 +02:00
ca-certificates \
containers-storage \
2025-05-17 22:55:09 +02:00
crun \
2025-05-16 17:42:27 +02:00
curl \
git \
2025-05-17 21:23:19 +02:00
netavark \
2025-05-16 17:42:27 +02:00
openssh-client \
2025-05-18 00:55:04 +02:00
podman \
podman-docker \
2025-05-16 17:42:27 +02:00
;
#gpg \
shared=/var/lib/shared/storage
2025-05-17 23:09:38 +02:00
buildah run $ctr -- sh -c "sed /usr/share/containers/storage.conf \
2025-05-18 16:30:39 +02:00
-e '/^additionalimagestores/a"'\
'" \"$shared\"' \
2025-05-17 23:09:38 +02:00
> /etc/containers/storage.conf"
2025-05-17 21:23:19 +02:00
2025-05-18 17:04:54 +02:00
buildah run $ctr -- sh -c "\
2025-05-18 16:30:39 +02:00
mkdir -p $shared/overlay-images $shared/overlay-layers; \
touch $shared/overlay-images/images.lock; \
touch $shared/overlay-layers/layers.lock; \
"
2025-05-16 17:42:27 +02:00
# yq https://github.com/mikefarah/yq?tab=readme-ov-file#install
2025-05-17 23:09:38 +02:00
buildah run $ctr -- sh -c "curl --silent --location \"https://github.com/mikefarah/yq/releases/download/$YQ_VERSION/yq_linux_amd64.tar.gz\" \
2025-05-16 17:42:27 +02:00
| tar --extract --gzip --to-stdout ./yq_linux_amd64 \
2025-05-17 23:09:38 +02:00
| install --owner=root --group=root --mode=0755 /dev/stdin /usr/local/bin/yq \
;"
2025-05-16 17:42:27 +02:00
# node https://github.com/nodesource/distributions?tab=readme-ov-file#using-debian-as-root-nodejs-22
2025-05-17 23:09:38 +02:00
buildah run $ctr -- sh -c "curl --silent --location \"https://deb.nodesource.com/setup_$NODE_VERSION\" | bash"
2025-05-17 21:31:54 +02:00
buildah run $ctr -- apt-get install -y --no-install-recommends nodejs
2025-05-16 17:42:27 +02:00
# pnpm https://nodejs.org/api/corepack.html#upgrading-the-global-versions
2025-05-17 21:31:54 +02:00
buildah run $ctr -- corepack install --global pnpm@$PNPM_VERSION
buildah run $ctr -- corepack enable pnpm
2025-05-16 17:42:27 +02:00
# Clear caches
2025-05-17 21:31:54 +02:00
buildah run $ctr -- rm -rf /var/lib/apt/lists/*
2025-05-16 17:42:27 +02:00
buildah commit --rm $ctr $1
# apt-get install -y --no-install-recommends \
# ca-certificates \
## gpg \
# ; \
# rm -rf /var/lib/apt/lists/*