diff --git a/.devcontainer/server/Dockerfile b/.devcontainer/server/Dockerfile new file mode 100644 index 0000000..39a25fe --- /dev/null +++ b/.devcontainer/server/Dockerfile @@ -0,0 +1,16 @@ +FROM mcr.microsoft.com/openjdk/jdk:21-ubuntu + +# Set build arguments for username, UID, and GID +ARG USERNAME=java +ARG USER_UID=1000 +ARG USER_GID=1000 + +# Create the user and group with the specified UID and GID +RUN groupadd --gid $USER_GID $USERNAME \ + && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME + +# Set the default user +USER $USERNAME + +# Set the working directory +WORKDIR /home/$USERNAME diff --git a/.devcontainer/server/devcontainer.json b/.devcontainer/server/devcontainer.json index b6824b2..176cf59 100644 --- a/.devcontainer/server/devcontainer.json +++ b/.devcontainer/server/devcontainer.json @@ -1,6 +1,8 @@ { "name": "OpenJDK21", - "image": "mcr.microsoft.com/openjdk/jdk:21-ubuntu", + "build": { + "dockerfile": "Dockerfile", + }, "features": { "ghcr.io/devcontainers/features/java:1": { "installMaven": "true"