collect reusable code
This commit is contained in:
parent
efd52d057f
commit
bacbf7d67e
10 changed files with 290 additions and 63 deletions
17
shared/build-image.ts
Normal file
17
shared/build-image.ts
Normal file
|
@ -0,0 +1,17 @@
|
|||
#!/usr/bin/env bun
|
||||
const $ = Bun.$;
|
||||
|
||||
const sharedDir = import.meta.dir;
|
||||
const tag = process.argv[2];
|
||||
const dirName = process.argv[3];
|
||||
const arches = process.argv[4].split(",");
|
||||
const pathToDnfCache = process.env["DNF_CACHE_PATH"];
|
||||
|
||||
await $`buildah manifest create ${tag}`;
|
||||
for (const arch of arches) {
|
||||
await $`buildah build --arch ${arch} \
|
||||
--pid=host --ipc=host --network=host --userns=host \
|
||||
--uts=host ${pathToDnfCache ? `-v /var/cache/dnf:/var/cache/dnf` : ""} \
|
||||
--manifest code.lightstands.xyz/standcoded/${tag} \
|
||||
--volume ${sharedDir}:/imgbuild:z ${dirName}`;
|
||||
}
|
39
shared/configure-nested-container.sh
Normal file
39
shared/configure-nested-container.sh
Normal file
|
@ -0,0 +1,39 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Copy & modify the defaults to provide reference if runtime changes needed.
|
||||
# Changes here are required for running with fuse-overlay storage inside container.
|
||||
sed -e 's|^#mount_program|mount_program|g' \
|
||||
-e '/additionalimage.*/a "/var/lib/shared",' \
|
||||
-e 's|^mountopt[[:space:]]*=.*$|mountopt = "nodev,fsync=0"|g' \
|
||||
/usr/share/containers/storage.conf \
|
||||
> /etc/containers/storage.conf && \
|
||||
chmod 644 /etc/containers/storage.conf && \
|
||||
chmod 644 /etc/containers/containers.conf
|
||||
|
||||
mkdir -p /var/lib/shared/overlay-images \
|
||||
/var/lib/shared/overlay-layers \
|
||||
/var/lib/shared/vfs-images \
|
||||
/var/lib/shared/vfs-layers && \
|
||||
touch /var/lib/shared/overlay-images/images.lock && \
|
||||
touch /var/lib/shared/overlay-layers/layers.lock && \
|
||||
touch /var/lib/shared/vfs-images/images.lock && \
|
||||
touch /var/lib/shared/vfs-layers/layers.lock
|
||||
|
||||
# Define uid/gid ranges for our user https://github.com/containers/buildah/issues/3053
|
||||
useradd action && \
|
||||
echo -e "action:1:999\action:1001:64535" > /etc/subuid && \
|
||||
echo -e "action:1:999\action:1001:64535" > /etc/subgid && \
|
||||
mkdir -p /home/action/.local/share/containers && \
|
||||
mkdir -p /home/action/.config/containers && \
|
||||
chown -R action:action /home/action
|
||||
|
||||
# See: https://github.com/containers/buildah/issues/4669
|
||||
# Copy & modify the config for the `action` user and remove the global
|
||||
# `runroot` and `graphroot` which current `actuib` user cannot access,
|
||||
# in such case storage will choose a runroot in `/var/tmp`.
|
||||
sed -e 's|^#mount_program|mount_program|g' \
|
||||
-e 's|^graphroot|#graphroot|g' \
|
||||
-e 's|^runroot|#runroot|g' \
|
||||
/etc/containers/storage.conf \
|
||||
> /home/action/.config/containers/storage.conf && \
|
||||
chown action:action /home/action/.config/containers/storage.conf
|
10
shared/fedora/instpkgs-minimal.sh
Normal file
10
shared/fedora/instpkgs-minimal.sh
Normal file
|
@ -0,0 +1,10 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
dnf update -y --setopt install_weak_deps=False && \
|
||||
dnf install -y --setopt install_weak_deps=False git git-lfs git-ftp fuse-overlayfs \
|
||||
nodejs nodejs-npm python3-devel python3-pip pipx \
|
||||
perl perl-CPAN ruby rubygems \
|
||||
clang gcc \
|
||||
coreutils bash aria2 jq yq zstd brotli sqlite \
|
||||
buildah podman \
|
||||
--exclude container-selinux
|
Loading…
Add table
Add a link
Reference in a new issue