Skip to content
Snippets Groups Projects
Commit 57ade5b8 authored by Guido Sterbini's avatar Guido Sterbini
Browse files

Some changes

parent f9557091
No related branches found
No related tags found
No related merge requests found
......@@ -42,60 +42,47 @@ RUN echo "deb [arch=$(dpkg --print-architecture)] \
&& apt-get -yqq clean \
&& chmod 0755 /root/create_eos_folders.sh \
&& /root/create_eos_folders.sh
# we can prepare the files and then ADD them directly
#&& echo '{"name":"home-a","hostport":"eoshome-a.cern.ch",\
# "remotemountdir":"/eos/user/a/","localmountdir":"/eos/user/a/"}' > \
# /etc/eos/fuse.home-a.conf \
#&& echo '{"name":"home-e","hostport":"eoshome-e.cern.ch", \
# "remotemountdir":"/eos/user/e/","localmountdir":"/eos/user/e/"}' > \
# /etc/eos/fuse.home-e.conf \
#&& echo '{"name":"home-s","hostport":"eoshome-s.cern.ch", \
# "remotemountdir":"/eos/user/s/","localmountdir":"/eos/user/s/"}' > \
# /etc/eos/fuse.home-s.conf \
#&& mkdir -p /eos/user/a \
#&& mkdir -p /eos/user/e \
#& mkdir -p /eos/user/s \
#&& echo '{"name":"project-l","hostport":"eosproject-l.cern.ch",\
# "remotemountdir":"/eos/project/l/","localmountdir":"/eos/project/l/"}' > \
# /etc/eos/fuse.project-l.conf \
#&& mkdir -p /eos/project/l
###############################################################################
# Installing AFS in the docker (not working)
# the main problem is related I think to docker
# https://stackoverflow.com/questions/53383431/how-to-enable-systemd-on-dockerfile-with-ubuntu18-04
# the present policy is to install it on the host_machine and share the volume with the docker
# e.g., http://abpcomputing.web.cern.ch/guides/openafs/
# ideally also for eos
#RUN apt-get install -y software-properties-common \
#&& apt-get update \
#&& add-apt-repository ppa:openafs/stable \
#&& apt-get update \
#&& apt-get upgrade \
#&& apt install -y openafs-client openafs-modules-dkms openafs-krb5 krb5-config
###############################################################################
# RUN apt-get install -y software-properties-common \
# && apt-get update \
# && add-apt-repository ppa:openafs/stable \
# && apt-get update \
# && apt-get upgrade \
# && apt install -y openafs-client openafs-modules-dkms openafs-krb5 krb5-config
###############################################################################
# Some minimal packages
###############################################################################
RUN apt-get -qq update \
&& apt-get -yqq install x11-apps sudo wget git tmux vim meld openssh-server\
build-essential cmake python-dev python3-dev \
&& apt-get -yqq clean
# COPY start.sh /root/start.sh
# RUN chmod 0755 /root/start.sh \
# && /root/start.sh
###############################################################################
# MAD-X installation (last releases)
###############################################################################
RUN wget http://madx.web.cern.ch/madx/releases/last-rel/madx-linux64-gnu \
&& mv madx-linux64-gnu /usr/bin/madx \
&& chmod +x /usr/bin/madx
###############################################################################
# Install miniconda
# https://hub.docker.com/r/continuumio/miniconda/dockerfile
###############################################################################
# from https://towardsdatascience.com/conda-pip-and-docker-ftw-d64fe638dc45
###############################################################################
SHELL [ "/bin/bash", "--login", "-c" ]
# Create a non-root user
ARG username=abpuser
ARG username=jovyan
ARG uid=1000
ARG gid=100
ENV USER $username
......@@ -111,89 +98,78 @@ RUN adduser --disabled-password \
$USER
COPY environment.yml requirements.txt /tmp/
RUN chown $UID:$GID /tmp/environment.yml /tmp/requirements.txt
COPY postBuild.sh /usr/local/bin/postBuild.sh
RUN chown $UID:$GID /usr/local/bin/postBuild.sh && \
chmod u+x /usr/local/bin/postBuild.sh
COPY entrypoint.sh /usr/local/bin/
RUN chown $UID:$GID /usr/local/bin/entrypoint.sh && \
chmod u+x /usr/local/bin/entrypoint.sh
RUN chown $UID:$GID /tmp/environment.yml /tmp/requirements.txt \
&& chown $UID:$GID /usr/local/bin/postBuild.sh \
&& chmod u+x /usr/local/bin/postBuild.sh \
&& chown $UID:$GID /usr/local/bin/entrypoint.sh \
&& chmod u+x /usr/local/bin/entrypoint.sh
USER $USER
# install miniconda
ENV MINICONDA_VERSION 4.7.12
ENV CONDA_DIR $HOME/miniconda3
RUN wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-$MINICONDA_VERSION-Linux-x86_64.sh -O ~/miniconda.sh && \
chmod +x ~/miniconda.sh && \
~/miniconda.sh -b -p $CONDA_DIR && \
rm ~/miniconda.sh
# make non-activate conda commands available
ENV PATH=$CONDA_DIR/bin:$PATH
# make conda activate command available from /bin/bash --login shells
RUN echo ". $CONDA_DIR/etc/profile.d/conda.sh" >> ~/.profile
# make conda activate command available from /bin/bash --interative shells
RUN conda init bash
# create a project directory inside user home
ENV PROJECT_DIR $HOME/app
RUN mkdir $PROJECT_DIR \
&& mkdir $HOME/local_host_folder
WORKDIR $PROJECT_DIR
RUN wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-$MINICONDA_VERSION-Linux-x86_64.sh -O ~/miniconda.sh \
&& chmod +x ~/miniconda.sh \
&& ~/miniconda.sh -b -p $CONDA_DIR \
&& rm ~/miniconda.sh \
# make conda activate command available from /bin/bash --login shells
&& echo ". $CONDA_DIR/etc/profile.d/conda.sh" >> ~/.profile \
# make conda activate command available from /bin/bash --interative shells
&& conda init bash \
# create a project directory inside user home
&& mkdir $HOME/local_host_home
WORKDIR $HOME
# build the conda environment
ENV ENV_PREFIX $HOME/env
RUN conda update --name base --channel defaults conda && \
conda env create --prefix $ENV_PREFIX --file /tmp/environment.yml --force && \
conda clean --all --yes
# run the postBuild script to install any JupyterLab extensions
RUN conda activate $ENV_PREFIX && \
/usr/local/bin/postBuild.sh && \
conda deactivate
#ENTRYPOINT [ "/usr/local/bin/entrypoint.sh" ]
###############################3
#ENV LANG=C.UTF-8 LC_ALL=C.UTF-8
#ENV PATH /opt/conda/bin:$PATH
#RUN apt-get update --fix-missing \
# && apt-get install -y wget bzip2 ca-certificates \
# && apt-get clean \
# && rm -rf /var/lib/apt/lists/*
#RUN wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-4.5.11-Linux-x86_64.sh -O ~/miniconda.sh \
# && /bin/bash ~/miniconda.sh -b -p /opt/conda \
# && rm ~/miniconda.sh \
# && /opt/conda/bin/conda clean -tipsy \
# && ln -s /opt/conda/etc/profile.d/conda.sh /etc/profile.d/conda.sh \
# && echo ". /opt/conda/etc/profile.d/conda.sh" >> ~/.bashrc \
# && echo "conda activate base" >> ~/.bashrc
#CMD /bin/bash -c "source root/bin/thisroot.sh":q
#CMD eosxd -ofsname=home-s
#USER jovyan
###########
#RUN pip install \
# ipython \
# cpymad \
# pandarallel \
# pyarrow \
# sphinx
###########
#RUN mkdir abp
#ENV HOME=/abp
#VOLUME /abp
#WORKDIR /abp
# Configure access to Jupyter
# CMD jupyter lab --no-browser --ip=0.0.0.0 --allow-root
RUN conda update --name base --channel defaults conda \
&& conda env create --prefix $ENV_PREFIX --file /tmp/environment.yml --force \
&& conda clean --all --yes \
# run the postBuild script to install any JupyterLab extensions
&& conda activate $ENV_PREFIX \
&& /usr/local/bin/postBuild.sh \
&& conda deactivate
ENV LANG=C.UTF-8 LC_ALL=C.UTF-8
ENV PATH /opt/conda/bin:$PATH
RUN conda activate $ENV_PREFIX \
&& pip install -r /tmp/requirements.txt \
&& pip install pyNAFF \
&& git clone https://github.com/SixTrack/pysixtrack.git \
&& cd pysixtrack \
&& pip install -e . \
&& cd .. \
&& git clone https://github.com/SixTrack/sixtracktools.git \
&& cd sixtracktools \
&& pip install -e . \
&& cd .. \
&& git clone https://github.com/SixTrack/sixtracklib.git \
&& cd sixtracklib \
&& mkdir build \
&& cd build \
&& cmake .. \
&& make \
&& cd ../python \
&& pip install -e . \
&& cd .. \
&& conda deactivate
COPY start.sh $HOME/start.sh
RUN echo "source /home/"$USER"/local_host_home/docker_start.sh" >> ~/.bashrc
USER $USER
CMD ["/bin/bash" ]
#docker build . -t sterbini/test
#docker run -it -u 0 -v /afs:/afs -v $PWD:/home/abpuser/local_host_folder --rm --cap-add SYS_ADMIN --device /dev/fuse sterbini/test
# FOR BUILDING
# docker build . --build-arg username=jovyan -t sterbini/test
# FOR RUNNING
# docker run -it -u 0 -v /afs:/afs -v ~:/home/jovyan/local_host_home -p 8889:8888 --rm --cap-add SYS_ADMIN --device /dev/fuse sterbini/test
# TO LAUNCH jupyterlab
# jupyter lab --no-browser --ip=0.0.0.0 --allow-root
# Installs
# A version of numpy no older than 1.14.0
# Exactly the version 0.23.4 of Pandas
numpy>=1.14.0
pandas>=0.23.4
ipython
jupyterlab
numpy
scipy
matplotlib
pandas
pyarrow
cpymad
pandarallel
sphinx
pdoc3
dask
#!/bin/bash
eosxd -ofsname=home-a
eosxd -ofsname=home-e
eosxd -ofsname=home-s
eosxd -ofsname=project-l
# Mounting EOS
if [ `whoami` == 'root' ]
then
if mountpoint -q /eos/user/s
then
:
else
eosxd -ofsname=home-s
fi
if mountpoint -q /eos/project/l
then
:
else
eosxd -ofsname=project-l
fi
fi
# activating conda
conda activate env/
alias jupy='jupyter lab --no-browser --ip=0.0.0.0 --allow-root'
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment