From f33bcbf3c0839c6bebb63141ff3d520b41084183 Mon Sep 17 00:00:00 2001 From: Matin Dehghani Date: Sun, 26 Jun 2022 01:07:34 +0200 Subject: More fine-grained image management (e.g. allow to get prebuilt images from other user and adapt ids inside with change-user.sh script) --- build/change-user.sh | 15 +++++++++++++++ build/extract.sh | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 build/change-user.sh (limited to 'build') diff --git a/build/change-user.sh b/build/change-user.sh new file mode 100644 index 0000000..cb13141 --- /dev/null +++ b/build/change-user.sh @@ -0,0 +1,15 @@ +#! /usr/bin/env bash + +set -o errexit + +image="$1" +[ -n "$image" ] || image="docker.io/chsa/tomo-remote:evelina" + +container=$(buildah from "$image") +buildah run $container sh -c "echo '$(id -ng):x:$(id -g):' >> /etc/group" +#buildah run $container sh -c "echo '$(id -nu):x:$(id -u):$(id -g):$(id -nu):/ccpi/data:/bin/bash' >> /etc/passwd" +buildah run $container sh -c "echo '$(id -nu):x:0:0:$(id -nu):/ccpi/data:/bin/bash' >> /etc/passwd" +buildah run $container sh -c "echo '$(id -nu):test' | chpasswd" +buildah commit --format docker $container tomo-remote:latest + +echo "$container build from ${image} and saved as tomo-remote:latest" diff --git a/build/extract.sh b/build/extract.sh index 17c6e3f..90793d5 100644 --- a/build/extract.sh +++ b/build/extract.sh @@ -6,7 +6,7 @@ image="$1" [ -n "$image" ] || { echo "Usage: $0 "; exit 1; } -container=$(buildah from localhost/${image}) +container=$(buildah from ${image}) path=$(buildah mount $container) mkdir -p ../repos/ cp -ra "$path/ccpi/repos"/* ../repos/ -- cgit v1.2.1