diff --git a/.github/workflows/dockerimage.yml b/.github/workflows/dockerimage.yml new file mode 100644 index 0000000..5d2092f --- /dev/null +++ b/.github/workflows/dockerimage.yml @@ -0,0 +1,21 @@ +name: Docker Image CI + +on: [push] + +jobs: + + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + - name: Build the Docker image + run: docker build . --file Dockerfile --tag loadedubuntu:${GITHUB_REF#refs/heads/} + - name: Dockerize + if: success() + uses: manusa/actions-publish-docker@v1.1.2 + with: + name: rcourt/loadedubuntu + username: ${{ secrets.DOCKER_HUB_USER }} + password: ${{ secrets.DOCKER_HUB_PASSWORD }} diff --git a/Dockerfile b/Dockerfile index a35512b..d340ac5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,35 +1,82 @@ -FROM ubuntu +FROM ubuntu:20.04 +ENV DEBIAN_FRONTEND=noninteractive VOLUME input VOLUME output VOLUME template -#cmtk -RUN apt-get -qq -y update \ -&& apt-get -qq -y install locales cmtk python python-pip python-dev ipython build-essential git nano autoconf nasm zip automake autoconf m4 libtool bison cmake flex xvfb imagej bc sec libpq-dev python3.7\ -&& pip install --upgrade virtualenv \ -&& pip install --upgrade pip - -#python image support -RUN pip install pynrrd -RUN pip install h5py - -#python neo4j support -RUN pip install requests -RUN pip install psycopg2 -RUN pip install neo4j +# Install base dependencies +RUN apt-get update && apt-get install -y \ + software-properties-common \ + && add-apt-repository -y ppa:deadsnakes/ppa \ + && apt-get update \ + && apt-get install -y \ + locales \ + cmtk \ + build-essential \ + git \ + nano \ + autoconf \ + nasm \ + zip \ + automake \ + m4 \ + libtool \ + bison \ + cmake \ + flex \ + xvfb \ + imagej \ + bc \ + sec \ + libpq-dev \ + python3.10 \ + python3.10-dev \ + python3.10-distutils \ + python3-pip \ + wget \ + curl \ + libdirectfb-dev \ + libjpeg-dev \ + zlib1g-dev \ + libsdl-gfx1.2-dev \ + libsdl1.2-dev \ + libasound2-dev \ + pkg-config \ + libpci-dev \ + dh-autoreconf \ + csh \ + && rm -rf /var/lib/apt/lists/* + +# Set Python 3.10 as default +RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1 \ + && update-alternatives --set python3 /usr/bin/python3.10 + +# Install pip for Python 3.10 +RUN curl -sS https://bootstrap.pypa.io/get-pip.py | python3.10 + +# Python image support +RUN python3.10 -m pip install pynrrd h5py + +# Environment variables +ENV MA=/opt/MouseAtlas +ENV PATH=/opt/MouseAtlas/bin:$PATH +ENV LD_LIBRARY_PATH=/opt/MouseAtlas/lib:$LD_LIBRARY_PATH +ENV LD_RUN_PATH=/opt/MouseAtlas/lib:$LD_RUN_PATH -#woolz -RUN apt-get -y install build-essential gcc make wget libdirectfb-dev libjpeg-dev zlib1g-dev libsdl-gfx1.2-dev gcc libsdl1.2-dev libasound2-dev pkg-config libpci-dev dh-autoreconf csh +# Woolz dependencies +RUN apt-get -y install build-essential gcc make wget libdirectfb-dev libjpeg-dev zlib1g-dev libsdl-gfx1.2-dev gcc libsdl1.2-dev libasound2-dev pkg-config libpci-dev dh-autoreconf csh ENV MA=/opt/MouseAtlas -RUN export PATH=/root/anaconda3/bin:/opt/VFB_neo4j/src:/opt/MouseAtlas/bin:$PATH +ENV PATH=/opt/MouseAtlas/bin:$PATH ENV LD_LIBRARY_PATH=/opt/MouseAtlas/lib:$LD_LIBRARY_PATH ENV LD_RUN_PATH=/opt/MouseAtlas/lib:$LD_RUN_PATH +# External Dependencies RUN cd /tmp/ \ && git clone https://github.com/ma-tech/External.git +# Install Fcgi RUN cd /tmp/External/ \ && cd Fcgi/ \ && tar -zxf fcgi-2.4.0.tar.gz \ @@ -39,6 +86,7 @@ RUN cd /tmp/External/ \ && make \ && make install +# Install Log4Cpp RUN cd /tmp/External/ \ && cd Log4Cpp \ && rm -rf log4cpp-1.0 \ @@ -49,6 +97,7 @@ RUN cd /tmp/External/ \ && make \ && make install +# Install PNG RUN cd /tmp/External/ \ && cd PNG \ && rm -rf libpng-1.6.29 \ @@ -58,6 +107,7 @@ RUN cd /tmp/External/ \ && make \ && make install +# Install JPEG RUN cd /tmp/External/ \ && cd Jpeg \ && rm -rf libjpeg-turbo-1.5.1 \ @@ -68,15 +118,17 @@ RUN cd /tmp/External/ \ && make \ && make install +# Install Tiff RUN cd /tmp/External/ \ && cd Tiff \ && rm -rf tiff-4.0.8 \ && tar -zxf tiff-4.0.8.tar.gz \ && cd tiff-4.0.8 \ -&& ./configure --prefix=$MA --disable-shared --enable-static --with-pic --with-jpeg-include-dir=$MA/include --with-jpeg-lib-dir==$MA/lib \ +&& ./configure --prefix=$MA --disable-shared --enable-static --with-pic --with-jpeg-include-dir=$MA/include --with-jpeg-lib-dir=$MA/lib \ && make \ && make install +# Install NIfTI RUN cd /tmp/External/ \ && cd NIfTI \ && tar -zxf nifticlib-2.0.0.tar.gz \ @@ -84,99 +136,66 @@ RUN cd /tmp/External/ \ && make \ && make install +# Install cJSON +RUN cd /tmp/ \ +&& git clone https://github.com/DaveGamble/cJSON.git \ +&& cd cJSON \ +&& mkdir build \ +&& cd build \ +&& cmake .. \ +&& make \ +&& make install + +# Woolz compilation RUN cd /tmp/ \ && git clone https://github.com/ma-tech/Woolz.git \ && cd Woolz \ +&& cp -v Readme.md README \ && mkdir -p m4 \ && libtoolize \ && aclocal \ && automake --add-missing \ && autoreconf -i --force \ && ./build.sh \ -&& ./configure --prefix=$MA --enable-optimise --enable-extff --with-jpeg=$MA --with-tiff=$MA --with-nifti=/usr/local/ \ +&& ./configure --prefix=$MA --enable-optimise --enable-extff --with-jpeg=$MA --with-tiff=$MA --with-nifti=/usr/local/ CPPFLAGS="-I/usr/local/include/cjson" LDFLAGS="-L/usr/local/lib" \ && make \ && make install - -# RUN cd /opt/ \ -# && git clone https://github.com/Robbie1977/NRRDtools.git -# RUN cd /opt/ \ -# && git clone https://github.com/Robbie1977/SWCtools.git -# RUN cd /opt/ \ -# && git clone https://github.com/Robbie1977/Bound.git -# RUN cd /opt/ \ -# && git clone https://github.com/Robbie1977/3DwarpScoring.git -# RUN cd /opt/ \ -# && git clone https://github.com/Robbie1977/IndexStackConv.git -# RUN cd /opt/ \ -# && git clone https://github.com/Robbie1977/3DstackDisplay.git -# RUN cd /opt/ \ -# && git clone https://github.com/Robbie1977/lsm2nrrd.git -# RUN cd /opt/ \ -# && git clone https://github.com/Robbie1977/nrrd2raw.git +# Clone VFB repositories RUN cd /opt/ \ -&& git clone https://github.com/VirtualFlyBrain/VFB_neo4j.git -# RUN cd /opt/ \ -# && git clone https://github.com/VirtualFlyBrain/StackProcessing.git -# RUN cd /opt/ \ -# && git clone https://github.com/VirtualFlyBrain/StackLoader.git -# RUN cd /opt/ \ -# && wget https://downloads.imagej.net/fiji/latest/fiji-linux64.zip \ -# && unzip fiji-linux64.zip \ -# && rm fiji-linux64.zip - -# ENV FIJI=/opt/Fiji.app/ImageJ-linux64 - -# RUN mkdir -p /data/ && cd /data/ \ -# && git clone https://github.com/VirtualFlyBrain/DrosAdultVNSdomains.git - -# RUN cd /data/ \ -# && git clone https://github.com/VirtualFlyBrain/DrosAdultBRAINdomains.git - -# RUN cd /data/ \ -# && git clone https://github.com/VirtualFlyBrain/DrosAdultHalfBRAINdomains.git - - - -# RUN mkdir -p /disk/data/VFB/IMAGE_DATA/ -# RUN ln -s /opt/StackLoader /disk/data/VFB/IMAGE_DATA/ -# RUN mkdir -p /partition/bocian/VFBTools -# RUN ln -s /opt/* /partition/bocian/VFBTools/ -# RUN ln -s /VFB /disk/data/VFB/IMAGE_DATA/ -# RUN mkdir -p /disk/data/VFBTools -# RUN ln -s /opt/Fiji.app /disk/data/VFBTools/ -# RUN mv /disk/data/VFBTools/Fiji.app /disk/data/VFBTools/Fiji -# RUN ln -s /opt/* /disk/data/VFBTools/ -# RUN ln -s /disk/data/VFBTools/MouseAtlas /disk/data/VFBTools/Woolz2013Full -# RUN mkdir -p /partition/karenin/VFB/IMAGE_DATA/ -# RUN ln -s /opt/StackLoader /partition/karenin/VFB/IMAGE_DATA/ -# RUN ln -s /VFB /partition/karenin/VFB/IMAGE_DATA/ -# RUN mkdir -p /partition/bocian/VFBTools/python-modules-2.6/bin/ -# RUN echo "#empty" > /partition/bocian/VFBTools/python-modules-2.6/bin/activate -# RUN ln -s /opt/StackProcessing /disk/data/VFB/IMAGE_DATA/ + && git clone https://github.com/VirtualFlyBrain/VFB_neo4j.git \ + && git clone https://github.com/VirtualFlyBrain/curation.git +# Set environment variables ENV TZAREA=Europe ENV TZCITY=London -ENV ANACONDAINS=Anaconda3-5.2.0-Linux-x86_64.sh +ENV ANACONDAINS=Anaconda3-2023.09-0-Linux-x86_64.sh ENV JUPYPASS="sha1:7f8e745dd219:b14fb15e0b4bc290a5d109ae97cba5c361b5d139" -#ipython jupyter notebook -RUN cd /tmp/ && \ -wget https://repo.anaconda.com/archive/${ANACONDAINS} && \ -bash ${ANACONDAINS} -b - -RUN conda install python=3.7 anaconda=custom - -#neo4j requirements -RUN /root/anaconda3/bin/pip install pynrrd -RUN /root/anaconda3/bin/pip install requests -RUN /root/anaconda3/bin/pip install psycopg2 -RUN /root/anaconda3/bin/pip install pandas -RUN /root/anaconda3/bin/pip install catpy - +# Install Anaconda +RUN cd /tmp/ \ + && wget https://repo.anaconda.com/archive/${ANACONDAINS} \ + && bash ${ANACONDAINS} -b + +# Install Python packages +RUN python3.10 -m pip install \ + requests \ + psycopg2-binary \ + neo4j \ + jupyter \ + ipykernel + +# Set up Python 3.10 kernel for Jupyter +RUN python3.10 -m ipykernel install --name 'python3.10' --display-name 'Python 3.10' + +# Install requirements from VFB repositories +RUN sed 's/^psycopg2$/psycopg2-binary/g' /opt/VFB_neo4j/requirements.txt >> /opt/requirements.txt \ + && sed 's/^psycopg2$/psycopg2-binary/g' /opt/curation/requirements.txt >> /opt/requirements.txt \ + && python3.10 -m pip install -r /opt/requirements.txt + +# Copy and prepare scripts COPY /scripts/* /scripts/ RUN chmod +x /scripts/*.sh ENTRYPOINT /scripts/startup.sh - EXPOSE 80 diff --git a/scripts/startup.sh b/scripts/startup.sh index e1f3c5f..9ada019 100644 --- a/scripts/startup.sh +++ b/scripts/startup.sh @@ -1,5 +1,10 @@ #!/bin/bash -for folder in $(find / | grep '/\.git$') ; do git --git-dir=$folder pull || : ; done; +/root/anaconda3/bin/jupyter lab --ip='*' --NotebookApp.password="${JUPYPASS}" --no-browser --port 80 --allow-root & -/root/anaconda3/bin/jupyter lab --ip='*' --NotebookApp.password="${JUPYPASS}" --no-browser --port 80 --allow-root +for folder in $(find /opt/ | grep '/\.git$') ; do echo $folder; cd $folder/../; git pull || : ; cd ..; sleep 10m; done; + +while true +do + sleep 999m +done