container: add password and wheel group membership

This commit is contained in:
Julian Wefers
2026-05-31 14:10:21 +02:00
parent 8a96decfdc
commit 68e798b881
2 changed files with 16 additions and 5 deletions
+3 -1
View File
@@ -5,7 +5,9 @@ RUN dnf install -y kernel-devel-$(uname -r | awk -F'-' '{print $1}')
RUN dnf install -y https://zfsonlinux.org/fedora/zfs-release-3-1$(rpm --eval "%{dist}").noarch.rpm
RUN dnf install -y zfs
RUN useradd -m -d /var/home/backup backup
RUN useradd -m -d /var/home/backup -G wheel backup
ARG PASSWORD
RUN echo "backup:${PASSWORD}" | chpasswd
RUN mkdir /backups && chown backup:backup /backups
COPY --chown=root:root --chmod=600 id_ed25519.pub /root/.ssh/authorized_keys
+13 -4
View File
@@ -2,9 +2,11 @@ REPO="gitea.wefers.page/julian/backup-server"
TAG="latest"
build() {
read -srp "Desired password for user 'backup' in resulting container image: " password
# ABSOLUTELY DO NOT USE --squash, as ostree NEEDS the layers
buildah build \
-t ${REPO}:${TAG} \
--build-arg PASSWORD="${password}" \
--pull \
--layers \
--format oci \
@@ -13,28 +15,35 @@ build() {
if [ $? -eq 0 ]; then
buildah login gitea.wefers.page -u julian -p 278b81490079574229dce45b66b726d2ae7e83c0
buildah push \
--compression-format zstd \
--compression-format zstd:chunked \
"${REPO}:${TAG}"
fi
}
mkImage() {
sudo podman run \
# set -euo
# echo "current partitions:"
# lsblk
# read -p "target USB stick device to write image to: /dev/" dev
podman run \
--rm \
-it \
--privileged \
--pull=newer \
--network=host \
--security-opt label=type:unconfined_t \
-v ./config.toml:/config.toml:ro \
-v ./output:/output \
-v /etc/containers/storage.conf:/etc/containers/storage.conf \
-v /var/lib/containers/storage:/var/lib/containers/storage \
-v ~/.local/share/containers/storage:/var/lib/containers/storage \
quay.io/centos-bootc/bootc-image-builder:latest \
--in-vm \
--type anaconda-iso \
--use-librepo=True \
--rootfs ex4 \
${REPO}:${TAG}
# sudo dd if=output/bootiso/install.iso of=/dev/${dev} bs=4M
}
$1