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)] \ ...@@ -42,60 +42,47 @@ RUN echo "deb [arch=$(dpkg --print-architecture)] \
&& apt-get -yqq clean \ && apt-get -yqq clean \
&& chmod 0755 /root/create_eos_folders.sh \ && chmod 0755 /root/create_eos_folders.sh \
&& /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) # Installing AFS in the docker (not working)
# the main problem is related I think to docker # the main problem is related I think to docker
# https://stackoverflow.com/questions/53383431/how-to-enable-systemd-on-dockerfile-with-ubuntu18-04 # 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 # 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/ # e.g., http://abpcomputing.web.cern.ch/guides/openafs/
# ideally also for eos # ideally also for eos
#RUN apt-get install -y software-properties-common \ ###############################################################################
#&& apt-get update \ # RUN apt-get install -y software-properties-common \
#&& add-apt-repository ppa:openafs/stable \ # && apt-get update \
#&& apt-get update \ # && add-apt-repository ppa:openafs/stable \
#&& apt-get upgrade \ # && apt-get update \
#&& apt install -y openafs-client openafs-modules-dkms openafs-krb5 krb5-config # && apt-get upgrade \
# && apt install -y openafs-client openafs-modules-dkms openafs-krb5 krb5-config
############################################################################### ###############################################################################
# Some minimal packages # Some minimal packages
############################################################################### ###############################################################################
RUN apt-get -qq update \ RUN apt-get -qq update \
&& apt-get -yqq install x11-apps sudo wget git tmux vim meld openssh-server\ && 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 && apt-get -yqq clean
# COPY start.sh /root/start.sh ###############################################################################
# RUN chmod 0755 /root/start.sh \ # MAD-X installation (last releases)
# && /root/start.sh ###############################################################################
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 # Install miniconda
# https://hub.docker.com/r/continuumio/miniconda/dockerfile # https://hub.docker.com/r/continuumio/miniconda/dockerfile
###############################################################################
# from https://towardsdatascience.com/conda-pip-and-docker-ftw-d64fe638dc45 # from https://towardsdatascience.com/conda-pip-and-docker-ftw-d64fe638dc45
###############################################################################
SHELL [ "/bin/bash", "--login", "-c" ] SHELL [ "/bin/bash", "--login", "-c" ]
# Create a non-root user # Create a non-root user
ARG username=abpuser ARG username=jovyan
ARG uid=1000 ARG uid=1000
ARG gid=100 ARG gid=100
ENV USER $username ENV USER $username
...@@ -111,89 +98,78 @@ RUN adduser --disabled-password \ ...@@ -111,89 +98,78 @@ RUN adduser --disabled-password \
$USER $USER
COPY environment.yml requirements.txt /tmp/ COPY environment.yml requirements.txt /tmp/
RUN chown $UID:$GID /tmp/environment.yml /tmp/requirements.txt
COPY postBuild.sh /usr/local/bin/postBuild.sh 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/ 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 USER $USER
# install miniconda
ENV MINICONDA_VERSION 4.7.12 ENV MINICONDA_VERSION 4.7.12
ENV CONDA_DIR $HOME/miniconda3 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 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 RUN wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-$MINICONDA_VERSION-Linux-x86_64.sh -O ~/miniconda.sh \
ENV PROJECT_DIR $HOME/app && chmod +x ~/miniconda.sh \
RUN mkdir $PROJECT_DIR \ && ~/miniconda.sh -b -p $CONDA_DIR \
&& mkdir $HOME/local_host_folder && rm ~/miniconda.sh \
WORKDIR $PROJECT_DIR # 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 # build the conda environment
ENV ENV_PREFIX $HOME/env ENV ENV_PREFIX $HOME/env
RUN conda update --name base --channel defaults conda && \ RUN conda update --name base --channel defaults conda \
conda env create --prefix $ENV_PREFIX --file /tmp/environment.yml --force && \ && conda env create --prefix $ENV_PREFIX --file /tmp/environment.yml --force \
conda clean --all --yes && conda clean --all --yes \
# run the postBuild script to install any JupyterLab extensions # run the postBuild script to install any JupyterLab extensions
RUN conda activate $ENV_PREFIX && \ && conda activate $ENV_PREFIX \
/usr/local/bin/postBuild.sh && \ && /usr/local/bin/postBuild.sh \
conda deactivate && conda deactivate
#ENTRYPOINT [ "/usr/local/bin/entrypoint.sh" ] ENV LANG=C.UTF-8 LC_ALL=C.UTF-8
ENV PATH /opt/conda/bin:$PATH
###############################3
#ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 RUN conda activate $ENV_PREFIX \
#ENV PATH /opt/conda/bin:$PATH && pip install -r /tmp/requirements.txt \
&& pip install pyNAFF \
&& git clone https://github.com/SixTrack/pysixtrack.git \
#RUN apt-get update --fix-missing \ && cd pysixtrack \
# && apt-get install -y wget bzip2 ca-certificates \ && pip install -e . \
# && apt-get clean \ && cd .. \
# && rm -rf /var/lib/apt/lists/* && git clone https://github.com/SixTrack/sixtracktools.git \
&& cd sixtracktools \
#RUN wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-4.5.11-Linux-x86_64.sh -O ~/miniconda.sh \ && pip install -e . \
# && /bin/bash ~/miniconda.sh -b -p /opt/conda \ && cd .. \
# && rm ~/miniconda.sh \ && git clone https://github.com/SixTrack/sixtracklib.git \
# && /opt/conda/bin/conda clean -tipsy \ && cd sixtracklib \
# && ln -s /opt/conda/etc/profile.d/conda.sh /etc/profile.d/conda.sh \ && mkdir build \
# && echo ". /opt/conda/etc/profile.d/conda.sh" >> ~/.bashrc \ && cd build \
# && echo "conda activate base" >> ~/.bashrc && cmake .. \
&& make \
&& cd ../python \
#CMD /bin/bash -c "source root/bin/thisroot.sh":q && pip install -e . \
#CMD eosxd -ofsname=home-s && cd .. \
&& conda deactivate
#USER jovyan
########### COPY start.sh $HOME/start.sh
#RUN pip install \ RUN echo "source /home/"$USER"/local_host_home/docker_start.sh" >> ~/.bashrc
# 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
USER $USER USER $USER
CMD ["/bin/bash" ] CMD ["/bin/bash" ]
#docker build . -t sterbini/test # FOR BUILDING
#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 # 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 # Installs
# A version of numpy no older than 1.14.0 ipython
# Exactly the version 0.23.4 of Pandas jupyterlab
numpy>=1.14.0 numpy
pandas>=0.23.4 scipy
matplotlib
pandas
pyarrow
cpymad
pandarallel
sphinx
pdoc3
dask
#!/bin/bash #!/bin/bash
eosxd -ofsname=home-a # Mounting EOS
eosxd -ofsname=home-e if [ `whoami` == 'root' ]
eosxd -ofsname=home-s then
eosxd -ofsname=project-l 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