FROM tensorflow/tensorflow:2.9.0-gpu

RUN apt-get update
RUN apt-get upgrade -y

# 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 git

# 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-net

RUN apt-get install git ffmpeg libsm6 libxext6 libopenexr-dev zip unzip htop nano -y
RUN pip install numpy matplotlib opencv-python wandb OpenEXR tensorflow-graphics scipy plotly pandas tensorboardX opencv-python cmapy

# defining the volumes that will be mounted
VOLUME [ "/data-net" ]
VOLUME [ "/data-local" ]
VOLUME [ "/home-net" ]

# Start the container with a bash shell
CMD ["/bin/bash"]