1+ # Base image with PyTorch and CUDA support
12FROM pytorch/pytorch:2.3.1-cuda11.8-cudnn8-runtime
3+
4+ # User arguments for container setup
25ARG user_name
36ARG uid
47ARG gid
5- ENV HOME=/root
6- WORKDIR ${HOME}
78
9+ # Install system dependencies
810ENV DEBIAN_FRONTEND=noninteractive
911RUN apt-get update -y && apt-get install -y --no-install-recommends \
10- vim zsh tmux wget curl htop jupyter python3 python3-pip libgl1-mesa-glx git sudo ssh libglib2.0-0 \
11- tree \
12+ libgl1-mesa-glx libglib2.0-0 \
1213 && apt-get -y autoclean \
1314 && apt-get -y autoremove \
1415 && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
15- && apt-get clean \
16- && apt-get update
17-
18- # Install conda packages as root
19- SHELL ["/bin/bash" , "-lc" ]
20- RUN conda install -y python=3.10 pytables=3.8.0 hdf5 jupyter
21-
22- # Install DeepLabCut and other pip packages as root
23- RUN pip install --no-cache-dir --upgrade pip setuptools && \
24- pip install --no-cache-dir gpustat nvitop pytest PySide6==6.3.1 streamlit networkx isort black && \
25- pip install --no-cache-dir amadeusgpt && \
26- pip install --no-cache-dir git+https://github.com/DeepLabCut/DeepLabCut.git
27-
28- # Initialize conda for zsh shell
29- RUN /opt/conda/bin/conda init zsh
16+ && apt-get clean
3017
3118# Create a non-root user
32- RUN mkdir /app /logs /data
19+ RUN mkdir -p /app /home/${user_name}
3320RUN groupadd -g ${gid} ${user_name} \
3421 && useradd -m -u ${uid} -g ${gid} ${user_name} \
35- && chown -R ${uid}:${gid} /home
22+ && chown -R ${uid}:${gid} /home/${user_name}
3623
3724# Switch to the new user and set home directory as working directory
3825USER ${user_name}
3926ENV HOME=/home/${user_name}
4027WORKDIR ${HOME}
4128
42- # Install Oh My Zsh and plugins
43- RUN sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" --unattended \
44- && git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions \
45- && git clone https://github.com/zsh-users/zsh-syntax-highlighting ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting \
46- && sed -i 's/^plugins=(.*)$/plugins=(git zsh-autosuggestions zsh-syntax-highlighting)/' ~/.zshrc
29+ # Create a user conda environment to avoid permission issues
30+ SHELL [ "/bin/bash" , "-c" ]
31+ RUN conda create -y --name amadeusGPT python=3.10
32+ ENV PATH=/opt/conda/envs/amadeusGPT/bin:$PATH
33+ RUN conda install -y -n amadeusGPT hdf5 pytables=3.8.0
4734
48- RUN echo "export PATH=$PATH:/home/${user_name}/.local/bin" >> /home/${user_name}/.zshrc
35+ # Install pip packages in the user environment
36+ RUN pip install --no-cache-dir notebook amadeusgpt
37+ RUN pip install -U --pre deeplabcut
4938
50- USER root
51- WORKDIR /app
39+ # Initialize conda for the user's bash
40+ RUN conda init bash
41+ RUN echo 'conda activate amadeusGPT' >> ${HOME}/.bashrc
5242
53- CMD [ "zsh" ]
54- SHELL ["/bin/zsh " , "-c " ]
43+ # Default command when container starts (activating the conda env)
44+ CMD ["bash " , "-l " ]
0 commit comments