Skip to content

Commit 2ba90f7

Browse files
committed
remove non-root user creation and switch to root for default command execution (this version past the test using notebooks/MausHaus_demo.ipynb)
1 parent db57410 commit 2ba90f7

File tree

1 file changed

+5
-15
lines changed

1 file changed

+5
-15
lines changed

Dockerfile

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Base image with PyTorch and CUDA support
22
FROM pytorch/pytorch:2.3.1-cuda11.8-cudnn8-runtime
33

4-
# User arguments for container setup
4+
# User arguments for container setup - keeping for compatibility with Makefile
55
ARG user_name
66
ARG uid
77
ARG gid
@@ -15,18 +15,6 @@ RUN apt-get update -y && apt-get install -y --no-install-recommends \
1515
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
1616
&& apt-get clean
1717

18-
# Create a non-root user
19-
RUN mkdir -p /app /home/${user_name}
20-
RUN groupadd -g ${gid} ${user_name} \
21-
&& useradd -m -u ${uid} -g ${gid} ${user_name} \
22-
&& chown -R ${uid}:${gid} /home/${user_name}
23-
24-
# Switch to the new user and set home directory as working directory
25-
USER ${user_name}
26-
ENV HOME=/home/${user_name}
27-
WORKDIR ${HOME}
28-
29-
# Create a user conda environment to avoid permission issues
3018
SHELL ["/bin/bash", "-c"]
3119
RUN conda create -y --name amadeusGPT python=3.10
3220
ENV PATH=/opt/conda/envs/amadeusGPT/bin:$PATH
@@ -36,9 +24,11 @@ RUN conda install -y -n amadeusGPT hdf5 pytables=3.8.0
3624
RUN pip install --no-cache-dir notebook amadeusgpt
3725
RUN pip install -U --pre deeplabcut
3826

39-
# Initialize conda for the user's bash
27+
# Initialize conda for bash
4028
RUN conda init bash
41-
RUN echo 'conda activate amadeusGPT' >> ${HOME}/.bashrc
29+
RUN echo 'conda activate amadeusGPT' >> ~/.bashrc
4230

31+
USER root
4332
# Default command when container starts (activating the conda env)
33+
WORKDIR /app
4434
CMD ["bash", "-l"]

0 commit comments

Comments
 (0)