diff options
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}" + |