spinalcordtoolbox / sct_docker

Docker distribution of Spinal Cord Toolbox
3 stars 3 forks source link

Refactoring of sct_docker generation code #51

Closed lrouhier closed 4 years ago

lrouhier commented 4 years ago

novelty

Readme modification Following the Feedback given by a user and replicated by Alex and myself, there seems to be a memory problem with version 4.2.1.The easy fix, which is not the most elegant, is to ask the user to increase the RAM allocated to the docker from 2GB to 3GB which seems to work. However, I did not find yet the reason for the memory issue. (related to https://github.com/neuropoly/spinalcordtoolbox/issues/2587 ) I modified the docker_shared_folder path to accomodate non-root user (feedback from class)

Vim install: Added the installation of Vim to the dockerfile, to have a text editor inside the container for the user. fix #50

Modified FSLDIR variable: FSLDIR variable was not correctly set when fsl was not installed

DOCKER env variable: Introduction of the DOCKER shell environment variable, that will be used by SCT to display the syntax for opening the QC report. More info at: https://github.com/neuropoly/spinalcordtoolbox/pull/2589

Fsleyes plugin warning fix: Added the installation of freeglut which is needed to remove some warning and help fix https://github.com/neuropoly/spinalcordtoolbox/issues/2587

Update of code 2020-01-31: refactoring of the code (indentation of string) to make it more readable. Removed Unreachable code ( if False statement) Removed automatic condition (if 1 statement) Created install_python=True param, which was hardcoded inside.

lrouhier commented 4 years ago

The Docker file does not really change because I strip leading white space. The goal was just to have a clearer code for the next modifications we might need to do. Here is an example of the docker file from commit 1a2de7a8f0602c2087ba27d5bb5ad91b8150accb (sorry for the file type github does not accept the docker file alone ) : sct-ubuntu-18.04-4.2.1.zip

I added it here in the collapsible as well

~~~ FROM ubuntu:18.04 RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections RUN apt-get update --fix-missing RUN apt-get install -y curl vim # For Qc message ENV DOCKER=yes apt-get update --fix-missing RUN apt-get install -y sudo # For conda RUN apt-get install -y bzip2 # For remote GUI access RUN apt-get install -y xorg xterm lxterminal RUN apt-get install -y openssh-server RUN useradd -ms /bin/bash sct RUN echo "sct ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers RUN echo "sct:sct" | chpasswd USER sct ENV HOME /home/sct WORKDIR /home/sct EXPOSE 22 RUN sudo apt-get install -y git # Install more fsleyes dependencies RUN sudo apt-get install -y python3-dev RUN sudo apt-get install -y python3-pip RUN sudo apt-get install -y liblapack-dev RUN sudo apt-get install -y gfortran # for pillow RUN sudo apt-get install -y libjpeg-dev ENV PYTHON python3 RUN mkdir -p ~/.local/bin RUN ln -sf $(which ${PYTHON}) ~/.local/bin/python SHELL ["/bin/bash", "-c"] RUN echo 'PATH="${PATH}:${HOME}/.local/bin"' >> ~/.bashenv ENV BASH_ENV ~/.bashenv RUN curl --location https://github.com/neuropoly/spinalcordtoolbox/archive/4.2.1.tar.gz | gunzip | tar x && cd spinalcordtoolbox-4.2.1 && yes | ./install_sct && cd - && rm -rf spinalcordtoolbox-4.2.1 ENV SCT_DIR /home/sct/sct_4.2.1 # Get data for offline use RUN bash -i -c "sct_download_data -d sct_example_data" RUN bash -i -c "sct_download_data -d sct_testing_data" # QC connection EXPOSE 8888 RUN echo X11UseLocalhost no | sudo tee --append /etc/ssh/sshd_config ENTRYPOINT bash -c 'sudo mkdir -p /run/sshd; sudo /usr/sbin/sshd; /bin/bash' RUN echo Finished ~~~