fix: Allow custom user ID (#2334)

This commit is contained in:
Kate Yurkova authored and GitHub committed 2023-08-12 20:17:38 +00:00
1 parent 5eb83e8acd
commit c599d0f3a1
2 files changed
+13 -4

No files matched your search

+4 -3
View File
@@ -1,5 +1,6 @@
ARG CUDA_VERSION=11.8.0
ARG OS_VERSION=22.04
ARG USER_ID=1000
# Define base image.
FROM nvidia/cuda:${CUDA_VERSION}-devel-ubuntu${OS_VERSION}
@@ -99,7 +100,7 @@ RUN git clone --branch 3.8 https://github.com/colmap/colmap.git --single-branch
rm -rf colmap
# Create non root user and setup environment.
RUN useradd -m -d /home/user -g root -G sudo -u 1000 user
RUN useradd -m -d /home/user -g root -G sudo -u ${USER_ID} user
RUN usermod -aG sudo user
# Set user password
RUN echo "user:user" | chpasswd
@@ -107,7 +108,7 @@ RUN echo "user:user" | chpasswd
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
# Switch to new uer and workdir.
USER 1000
USER ${USER_ID}
WORKDIR /home/user
# Add local user binary folder to PATH variable.
@@ -154,7 +155,7 @@ RUN python3.10 -m pip install omegaconf
ADD . /home/user/nerfstudio
USER root
RUN chown -R user /home/user/nerfstudio
USER 1000
USER ${USER_ID}
# Install nerfstudio dependencies.
RUN cd nerfstudio && \