From 5ea06d1176a048f28991fc79a863603739fa8e9b Mon Sep 17 00:00:00 2001 From: Hunor Laczko Date: Thu, 2 Feb 2023 12:51:22 +0100 Subject: [PATCH] basic docker template --- template/Dockerfile | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 template/Dockerfile diff --git a/template/Dockerfile b/template/Dockerfile new file mode 100644 index 0000000..e5a08d6 --- /dev/null +++ b/template/Dockerfile @@ -0,0 +1,32 @@ +# Use an existing image as the base +FROM ubuntu:22.04 + +# Add the current user to the image +ARG USER_NAME=lhunor +ARG USER_ID=11017 +ARG GROUP_NAME=guest +ARG GROUP_ID=11000 + +# Update the system and install required packages +RUN apt-get update && apt-get upgrade -y && apt-get install -y sudo + +# Create a new group with the same GID as the host +RUN groupadd --gid $GROUP_ID $GROUP_NAME + +# Create a new user with the same UID and GID as the host +RUN useradd --uid $USER_ID --gid $GROUP_ID --shell /bin/bash --create-home $USER_NAME + +# don't require password with sudo, for convenience +# not the safest thing to do, but hopefully okay inside the container +RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers + +# Add the new user to the sudo group +RUN usermod -aG sudo $USER_NAME + +# Set the default user to the new user +USER $USER_NAME + +WORKDIR /home/$USER_NAME + +# Start the container with a bash shell +CMD ["/bin/bash"] \ No newline at end of file