container: add password and wheel group membership
This commit is contained in:
+3
-1
@@ -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 https://zfsonlinux.org/fedora/zfs-release-3-1$(rpm --eval "%{dist}").noarch.rpm
|
||||||
RUN dnf install -y zfs
|
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
|
RUN mkdir /backups && chown backup:backup /backups
|
||||||
|
|
||||||
COPY --chown=root:root --chmod=600 id_ed25519.pub /root/.ssh/authorized_keys
|
COPY --chown=root:root --chmod=600 id_ed25519.pub /root/.ssh/authorized_keys
|
||||||
|
|||||||
+13
-4
@@ -2,9 +2,11 @@ REPO="gitea.wefers.page/julian/backup-server"
|
|||||||
TAG="latest"
|
TAG="latest"
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
|
read -srp "Desired password for user 'backup' in resulting container image: " password
|
||||||
# ABSOLUTELY DO NOT USE --squash, as ostree NEEDS the layers
|
# ABSOLUTELY DO NOT USE --squash, as ostree NEEDS the layers
|
||||||
buildah build \
|
buildah build \
|
||||||
-t ${REPO}:${TAG} \
|
-t ${REPO}:${TAG} \
|
||||||
|
--build-arg PASSWORD="${password}" \
|
||||||
--pull \
|
--pull \
|
||||||
--layers \
|
--layers \
|
||||||
--format oci \
|
--format oci \
|
||||||
@@ -13,28 +15,35 @@ build() {
|
|||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
buildah login gitea.wefers.page -u julian -p 278b81490079574229dce45b66b726d2ae7e83c0
|
buildah login gitea.wefers.page -u julian -p 278b81490079574229dce45b66b726d2ae7e83c0
|
||||||
buildah push \
|
buildah push \
|
||||||
--compression-format zstd \
|
--compression-format zstd:chunked \
|
||||||
"${REPO}:${TAG}"
|
"${REPO}:${TAG}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mkImage() {
|
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 \
|
--rm \
|
||||||
-it \
|
-it \
|
||||||
--privileged \
|
--privileged \
|
||||||
--pull=newer \
|
--pull=newer \
|
||||||
--network=host \
|
|
||||||
--security-opt label=type:unconfined_t \
|
--security-opt label=type:unconfined_t \
|
||||||
-v ./config.toml:/config.toml:ro \
|
-v ./config.toml:/config.toml:ro \
|
||||||
-v ./output:/output \
|
-v ./output:/output \
|
||||||
-v /etc/containers/storage.conf:/etc/containers/storage.conf \
|
-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 \
|
quay.io/centos-bootc/bootc-image-builder:latest \
|
||||||
|
--in-vm \
|
||||||
--type anaconda-iso \
|
--type anaconda-iso \
|
||||||
--use-librepo=True \
|
--use-librepo=True \
|
||||||
|
--rootfs ex4 \
|
||||||
${REPO}:${TAG}
|
${REPO}:${TAG}
|
||||||
|
|
||||||
|
# sudo dd if=output/bootiso/install.iso of=/dev/${dev} bs=4M
|
||||||
}
|
}
|
||||||
|
|
||||||
$1
|
$1
|
||||||
|
|||||||
Reference in New Issue
Block a user