@@ -7,39 +7,70 @@ ENV LD_LIBRARY_PATH /usr/local/cuda/extras/CUPTI/lib64:$LD_LIBRARY_PATH
77# setup time zone for tz
88ENV TZ=Europe/Paris
99RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
10+ ENV LANG C.UTF-8
1011
11- # Install python3.7
12- RUN apt-get update
13- RUN apt-get install -y software-properties-common wget
14- RUN add-apt-repository ppa:deadsnakes/ppa
1512RUN apt-get update
16- RUN apt-get install -y python3.7 python3.7-dev python3.7-tk python3-pip python3.7-venv git ffmpeg libgtk-3-dev
13+ RUN apt-get install -y software-properties-common wget git
1714
18- # Install Python dependencies
19- ARG PYTHON=python3.7
20- ENV LANG C.UTF-8
21- ENV CONDA_PATH=/opt/anaconda3
22- ENV ENVIRONMENT_NAME=main
23- SHELL ["/bin/bash" , "-c" ]
15+ # Install conda from: https://towardsdatascience.com/conda-pip-and-docker-ftw-d64fe638dc45
16+ SHELL [ "/bin/bash" , "--login" , "-c" ]
2417
25- # Download and install Anaconda.
26- ENV LATEST_CONDA_SCRIPT "Anaconda3-5.3.1-Linux-x86_64.sh"
27- ENV PATH="/root/anaconda2/bin:${PATH}"
18+ # Create a non-root user
19+ ARG username=si
20+ ARG uid=1000
21+ ARG gid=100
22+ ENV USER $username
23+ ENV UID $uid
24+ ENV GID $gid
25+ ENV HOME /home/$USER
26+ RUN adduser --disabled-password \
27+ --gecos "Non-root user" \
28+ --uid $UID \
29+ --gid $GID \
30+ --home $HOME \
31+ $USER
2832
29- RUN wget https://repo.continuum.io/archive/$LATEST_CONDA_SCRIPT
33+ COPY entrypoint.sh /usr/local/bin/
34+ RUN chown $UID:$GID /usr/local/bin/entrypoint.sh && \
35+ chmod u+x /usr/local/bin/entrypoint.sh
3036
31- RUN bash $LATEST_CONDA_SCRIPT -b -p /home/anaconda3 \
32- && echo "export PATH=/home/anaconda/bin:$PATH" >> ~/.bashrc \
33- && /bin/bash -c "source /root/.bashrc"
3437
35- ENV PATH /home/anaconda3/bin:$PATH
38+ USER $USER
39+ # install miniconda
40+ ENV MINICONDA_VERSION 4.8.2
41+ ENV CONDA_DIR $HOME/miniconda3
42+ # https://repo.anaconda.com/miniconda/Miniconda3-py39_4.9.2-Linux-x86_64.sh
43+ ENV LATEST_CONDA_SCRIPT "Miniconda3-py37_$MINICONDA_VERSION-Linux-x86_64.sh"
3644
37- RUN conda install pytorch==1.2
38- # RUN rm $LATEST_CONDA_SCRIPT
39- # conda install pytorch==1.2.0 torchvision==0.4.0 cudatoolkit=10.0 -c pytorch
4045
46+ RUN wget --quiet https://repo.anaconda.com/miniconda/$LATEST_CONDA_SCRIPT -O ~/miniconda.sh && \
47+ chmod +x ~/miniconda.sh && \
48+ ~/miniconda.sh -b -p $CONDA_DIR && \
49+ rm ~/miniconda.sh
50+
51+ # make non-activate conda commands available
52+ ENV PATH=$CONDA_DIR/bin:$PATH
53+ # make conda activate command available from /bin/bash --login shells
54+ RUN echo ". $CONDA_DIR/etc/profile.d/conda.sh" >> ~/.profile
55+ # make conda activate command available from /bin/bash --interative shells
56+ RUN conda init bash
57+
58+ # create a project directory inside user home
59+ ENV PROJECT_DIR $HOME/app
60+ RUN mkdir $PROJECT_DIR
61+ WORKDIR $PROJECT_DIR
62+
63+ ENV CONDA_ENV_NAME yass
64+ RUN conda create -n $CONDA_ENV_NAME
65+ RUN conda activate $CONDA_ENV_NAME
66+
67+
68+ # install yass
69+ RUN conda install pytorch==1.2
70+ # RUN git clone --depth 1 --branch v2.0 https://github.com/paninski-lab/yass \
4171RUN git clone https://github.com/paninski-lab/yass \
4272 && cd yass \
73+ && git checkout d9c9e2c52287afeb3256bdfde749f75f5083fd5d \
4374 && pip --no-cache-dir install -e . \
4475 && cd src/gpu_bspline_interp \
4576 && python setup.py install --force \
@@ -50,5 +81,5 @@ RUN git clone https://github.com/paninski-lab/yass \
5081 && pip install .
5182
5283RUN pip install scipy==1.2.0
53- # cd yass/samples/10chan
54- # yass sort config.yaml
84+
85+ ENTRYPOINT [ "/usr/local/bin/entrypoint.sh" ]
0 commit comments