diff options
author | Georg | 2021-08-14 10:02:44 +0200 |
---|---|---|
committer | Georg | 2021-08-14 10:10:42 +0200 |
commit | c27753da863b3c44ceb81b2fe6ac689550704f89 (patch) | |
tree | 40e31d653640e43188ce5b45e08136297210a63f /lcpubsh/image_template | |
download | public-shell-c27753da863b3c44ceb81b2fe6ac689550704f89.tar.gz public-shell-c27753da863b3c44ceb81b2fe6ac689550704f89.tar.bz2 public-shell-c27753da863b3c44ceb81b2fe6ac689550704f89.zip |
Init
Signed-off-by: Georg <georg@lysergic.dev>
Diffstat (limited to 'lcpubsh/image_template')
-rw-r--r-- | lcpubsh/image_template/Dockerfile | 9 | ||||
-rw-r--r-- | lcpubsh/image_template/user-mapping.sh | 21 |
2 files changed, 30 insertions, 0 deletions
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}" + |