Commit 6b8cce24 authored by Michele Compostella's avatar Michele Compostella
Browse files

Using standard user for the container

parent bdbfdffb
...@@ -31,17 +31,6 @@ ...@@ -31,17 +31,6 @@
# Importing Ubuntu image # Importing Ubuntu image
FROM ubuntu:18.04 FROM ubuntu:18.04
# Build arguments
ARG PREFIX
# Environment variables
ENV DEBIAN_FRONTEND noninteractive
ENV QUIP_ARCH linux_x86_64_gfortran
ENV QUIP_STRUCTS_DIR $PREFIX/QUIP/structs
ENV QUIP_INSTALLDIR $PREFIX/QUIP/bin
USER $USER
WORKDIR /root/
# Updating distro # Updating distro
RUN \ RUN \
apt-get update && \ apt-get update && \
...@@ -55,54 +44,71 @@ RUN \ ...@@ -55,54 +44,71 @@ RUN \
apt-get autoclean && \ apt-get autoclean && \
apt-get autoremove apt-get autoremove
# Installing Python3 modules
RUN pip3 install numpy matplotlib vtk
RUN pip3 install mayavi
# Adding standard user
RUN adduser --disabled-password --gecos '' --uid 1000 --gid 100 favad
# Environment variables
ENV DEBIAN_FRONTEND noninteractive
ENV HOME /home/favad
ENV PREF $HOME/software
ENV QUIP_ARCH linux_x86_64_gfortran
ENV QUIP_STRUCTS_DIR $PREF/QUIP/structs
ENV QUIP_INSTALLDIR $PREF/QUIP/bin
# Copying software source files # Copying software source files
COPY ./software /tmp/software COPY ./software /tmp/software
RUN chown -R favad /tmp/software
# Creating installation folder # Copying sample files
RUN mkdir -p $PREFIX COPY ./sample $HOME/sample
RUN chown -R favad $HOME/sample
# Installing Python3 modules # Switching to standard user
RUN pip3 install numpy matplotlib vtk USER favad
RUN pip3 install mayavi WORKDIR $HOME
# Creating installation folder
RUN mkdir -p $PREF
# Installing QUIP # Installing QUIP
RUN \ RUN \
tar xvzf /tmp/software/QUIP.tar.gz -C $PREFIX/. && \ tar xvzf /tmp/software/QUIP.tar.gz -C $PREF/. && \
cd $PREFIX/QUIP/ && \ cd $PREF/QUIP/ && \
tar xvzf /tmp/software/GAP.tar.gz -C $PREFIX/QUIP/src/. && \ tar xvzf /tmp/software/GAP.tar.gz -C $PREF/QUIP/src/. && \
(echo ; echo ; echo ; echo ; echo ; echo ; echo ; echo ; echo ; echo ; echo ; echo y ; echo ; echo ; echo ; echo ; echo ; echo ; echo ; echo ; echo ; echo ; echo ; echo ; echo ) | make config && \ (echo ; echo ; echo ; echo ; echo ; echo ; echo ; echo ; echo ; echo ; echo ; echo y ; echo ; echo ; echo ; echo ; echo ; echo ; echo ; echo ; echo ; echo ; echo ; echo ; echo ) | make config && \
make && \ make && \
make install make install
# Installing VORO++ # Installing VORO++
RUN \ RUN \
mkdir -p $PREFIX/voro++ && \ mkdir -p $PREF/voro++ && \
tar xvzf /tmp/software/voro++-0.4.6.tar.gz -C $PREFIX/voro++ --strip-components 1 && \ tar xvzf /tmp/software/voro++-0.4.6.tar.gz -C $PREF/voro++ --strip-components 1 && \
cd $PREFIX/voro++/ && \ cd $PREF/voro++/ && \
sed -i "21s|.*|PREFIX=$PREFIX/voro++|" ./config.mk && \ sed -i "21s|.*|PREFIX=$PREF/voro++|" ./config.mk && \
make && \ make && \
make install make install
# Installing KDTREE2 # Installing KDTREE2
RUN \ RUN \
tar xvzf /tmp/software/kdtree2.tar.gz -C $PREFIX/. && \ tar xvzf /tmp/software/kdtree2.tar.gz -C $PREF/. && \
cd $PREFIX/kdtree2/ && \ cd $PREF/kdtree2/ && \
gfortran -c kdtree2.f90 && \ gfortran -c kdtree2.f90 && \
gfortran -o kdtree2_iaea_v03.x kdtree2_iaea_v03.f90 kdtree2.o gfortran -o kdtree2_iaea_v03.x kdtree2_iaea_v03.f90 kdtree2.o
# Installing VisIt # Installing VisIt
RUN \ RUN \
mkdir -p $PREFIX/visit/ && \ mkdir -p $PREF/visit/ && \
cd /tmp/software/ && \ cd /tmp/software/ && \
chmod 755 /tmp/software/visit-install2_13_3 && \ chmod 755 ./visit-install2_13_3 && \
(echo 1) | bash ./visit-install2_13_3 2.13.3 linux-x86_64-ubuntu18-wmesa $PREFIX/visit/ (echo 1) | bash ./visit-install2_13_3 2.13.3 linux-x86_64-ubuntu18-wmesa $PREF/visit/
# Removing installation packages # Removing installation packages
RUN rm -rf /tmp/software/ RUN rm -rf /tmp/software/
# Copying sample files
COPY ./sample /root/sample
# Run bash when the container launches # Run bash when the container launches
CMD ["/bin/bash"] CMD ["/bin/bash"]
...@@ -55,15 +55,15 @@ If these optional parameters are not specified, the build process will ask for t ...@@ -55,15 +55,15 @@ If these optional parameters are not specified, the build process will ask for t
Once the Docker image has been created and the [Docker daemon is running](https://docs.docker.com/config/daemon/), you can shell into the container mounting a local folder where the output files will be stored, using: Once the Docker image has been created and the [Docker daemon is running](https://docs.docker.com/config/daemon/), you can shell into the container mounting a local folder where the output files will be stored, using:
```shell ```shell
sudo docker run -t -i --volume $HOME/favad_output/:/root/sample/output/ favad /bin/bash sudo docker run -t -i --volume $HOME/favad_output/:/home/favad/sample/output/ favad /bin/bash
``` ```
Using the previous command, the ouput files generated inside the Docker container will be available in $HOME/faved_output/ of your local machine. Please note that the content of this folder will be overwritten, if the folder is not empty. Using the previous command, the ouput files generated inside the Docker container will be available in $HOME/faved_output/ of your local machine. Please note that the content of this folder will be overwritten, if the folder is not empty.
At this point you can run the workflow for fingerprinting and visualizing defects on the sample dataset inside the Docker container: At this point you can run the workflow for fingerprinting and visualizing defects on the sample dataset inside the Docker container:
```shell ```shell
cd /root/sample/ cd /home/favad/sample/
python3 FaVaD.py -p /root/sample/parameters.txt python3 FaVaD.py -p /home/favad/sample/parameters.txt
``` ```
--- ---
......
...@@ -113,10 +113,10 @@ echo ...@@ -113,10 +113,10 @@ echo
echo "Build complete!" echo "Build complete!"
echo echo
echo "You can run the image interactively mounting an ouput folder (use the full path) with:" echo "You can run the image interactively mounting an ouput folder (use the full path) with:"
echo " sudo docker run -t -i --volume $HOME/favad_output/:/root/sample/output/ favad /bin/bash" echo " sudo docker run -t -i --volume $HOME/favad_output/:/home/favad/sample/output/ favad /bin/bash"
echo "and, once in the container" echo "and, once in the container"
echo " cd /root/sample/" echo " cd /home/favad/sample/"
echo " python3 FaVaD.py -p /root/sample/parameters.txt" echo " python3 FaVaD.py -p /home/favad/sample/parameters.txt"
echo echo
# Disarming trap and exit # Disarming trap and exit
......
...@@ -6,36 +6,36 @@ ...@@ -6,36 +6,36 @@
# General Parameters # General Parameters
#################### ####################
# Output folder # Output folder
OUTPUT_PATH = /root/sample/output/ OUTPUT_PATH = /home/favad/sample/output/
#################### ####################
# Calculation of DVs # Calculation of DVs
#################### ####################
# Path to QUIP executable # Path to QUIP executable
QUIP_PATH = /root/software/QUIP/bin/quip QUIP_PATH = /home/favad/software/QUIP/bin/quip
# Input xyz file for QUIP (damaged sample) # Input xyz file for QUIP (damaged sample)
QUIP_XYZ = /root/sample/input/fe_sample.xyz QUIP_XYZ = /home/favad/sample/input/fe_sample.xyz
# Input reference descriptor vectors # Input reference descriptor vectors
BCC_VEC = /root/sample/input/bcc_vector.dat BCC_VEC = /home/favad/sample/input/bcc_vector.dat
INT_VEC = /root/sample/input/interstitial_vector.dat INT_VEC = /home/favad/sample/input/interstitial_vector.dat
VAC_VEC = /root/sample/input/vacancy_vector.dat VAC_VEC = /home/favad/sample/input/vacancy_vector.dat
TYPA_VEC = /root/sample/input/typea_vector.dat TYPA_VEC = /home/favad/sample/input/typea_vector.dat
# Path to VORO++ executable # Path to VORO++ executable
VORO_PATH = /root/software/voro++/bin/voro++ VORO_PATH = /home/favad/software/voro++/bin/voro++
########################################## ##########################################
# Calculation of the nearest atom location # Calculation of the nearest atom location
########################################## ##########################################
# Path to kdtree executable # Path to kdtree executable
KDTREE_PATH = /root/software/kdtree2/kdtree2_iaea_v03.x KDTREE_PATH = /home/favad/software/kdtree2/kdtree2_iaea_v03.x
# Input parameter file for kdtree # Input parameter file for kdtree
KDTREE_PAR = /root/sample/input/void_code_input.txt KDTREE_PAR = /home/favad/sample/input/void_code_input.txt
# Threshold constant for identification of a voids # Threshold constant for identification of a voids
KDTREE_THR = 3.00 KDTREE_THR = 3.00
...@@ -44,12 +44,12 @@ KDTREE_THR = 3.00 ...@@ -44,12 +44,12 @@ KDTREE_THR = 3.00
# Visualization # Visualization
############### ###############
# Path to visit executable # Path to visit executable
VISIT_PATH = /root/software/visit/bin/visit VISIT_PATH = /home/favad/software/visit/bin/visit
# Path to VisIt visualization script # Path to VisIt visualization script
VISIT_SCRIPT = /root/sample/input/vis.py VISIT_SCRIPT = /home/favad/sample/input/vis.py
# Name for the final frames and movie # Name for the final frames and movie
VIS_NAME = fe_sample VIS_NAME = fe_sample
# Path to the bash script for the movie creation # Path to the bash script for the movie creation
MOVIE_SCRIPT = /root/sample/input/movie.sh MOVIE_SCRIPT = /home/favad/sample/input/movie.sh
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment