17 lines
402 B
Docker
17 lines
402 B
Docker
|
|
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
|