From c27753da863b3c44ceb81b2fe6ac689550704f89 Mon Sep 17 00:00:00 2001 From: Georg Date: Sat, 14 Aug 2021 10:02:44 +0200 Subject: Init Signed-off-by: Georg --- lcpubsh/image_template/Dockerfile | 9 +++++++++ lcpubsh/image_template/user-mapping.sh | 21 +++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 lcpubsh/image_template/Dockerfile create mode 100644 lcpubsh/image_template/user-mapping.sh (limited to 'lcpubsh/image_template') diff --git a/lcpubsh/image_template/Dockerfile b/lcpubsh/image_template/Dockerfile new file mode 100644 index 0000000..85b1008 --- /dev/null +++ b/lcpubsh/image_template/Dockerfile @@ -0,0 +1,9 @@ +# Original by https://github.com/sleeepyjack/dockersh +# Modified by georg@lysergic.dev +# Note! This is a skeleton, it is being altered by the spawn process. +FROM lc-archlinux-userbase-v2:sh0 + +COPY user-mapping.sh / +RUN chmod u+x /user-mapping.sh + +ENTRYPOINT ["/user-mapping.sh"] diff --git a/lcpubsh/image_template/user-mapping.sh b/lcpubsh/image_template/user-mapping.sh new file mode 100644 index 0000000..f2aa456 --- /dev/null +++ b/lcpubsh/image_template/user-mapping.sh @@ -0,0 +1,21 @@ +#!/bin/bash +# Original by https://github.com/sleeepyjack/dockersh +# Modified by georg@lysergic.dev +if [ -z "${HOST_USER_NAME}" -o -z "${HOST_USER_ID}" -o -z "${HOST_USER_GID}" ]; then + echo "HOST_USER_NAME, HOST_USER_ID & HOST_USER_GID needs to be set!"; exit 100 +fi + +useradd \ + --uid ${HOST_USER_ID} \ + --gid ${HOST_USER_GID} \ + --create-home \ + --shell /bin/bash \ + ${HOST_USER_NAME} +groupadd --gid "${HOST_USER_GID}" "${HOST_USER_NAME}" +usermod -aG sudo ${HOST_USER_NAME} +sleep 5s + +echo ${HOST_USER_NAME}:${HOST_USER_NAME} | chpasswd + +exec su - "${HOST_USER_NAME}" + -- cgit v1.2.3