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

Using standard user for the container

parent bdbfdffb
......@@ -31,17 +31,6 @@
# Importing Ubuntu image
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
RUN \
apt-get update && \
......@@ -55,54 +44,71 @@ RUN \
apt-get autoclean && \
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
COPY ./software /tmp/software
RUN chown -R favad /tmp/software
# Creating installation folder
RUN mkdir -p $PREFIX
# Copying sample files
COPY ./sample $HOME/sample
RUN chown -R favad $HOME/sample
# Installing Python3 modules
RUN pip3 install numpy matplotlib vtk
RUN pip3 install mayavi
# Switching to standard user
USER favad
WORKDIR $HOME
# Creating installation folder
RUN mkdir -p $PREF
# Installing QUIP
RUN \
tar xvzf /tmp/software/QUIP.tar.gz -C $PREFIX/. && \
cd $PREFIX/QUIP/ && \
tar xvzf /tmp/software/GAP.tar.gz -C $PREFIX/QUIP/src/. && \
tar xvzf /tmp/software/QUIP.tar.gz -C $PREF/. && \
cd $PREF/QUIP/ && \
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 && \
make && \
make install
# Installing VORO++
RUN \
mkdir -p $PREFIX/voro++ && \
tar xvzf /tmp/software/voro++-0.4.6.tar.gz -C $PREFIX/voro++ --strip-components 1 && \
cd $PREFIX/voro++/ && \
sed -i "21s|.*|PREFIX=$PREFIX/voro++|" ./config.mk && \
mkdir -p $PREF/voro++ && \
tar xvzf /tmp/software/voro++-0.4.6.tar.gz -C $PREF/voro++ --strip-components 1 && \
cd $PREF/voro++/ && \
sed -i "21s|.*|PREFIX=$PREF/voro++|" ./config.mk && \
make && \
make install
# Installing KDTREE2
RUN \
tar xvzf /tmp/software/kdtree2.tar.gz -C $PREFIX/. && \
cd $PREFIX/kdtree2/ && \
tar xvzf /tmp/software/kdtree2.tar.gz -C $PREF/. && \
cd $PREF/kdtree2/ && \
gfortran -c kdtree2.f90 && \
gfortran -o kdtree2_iaea_v03.x kdtree2_iaea_v03.f90 kdtree2.o
# Installing VisIt
RUN \
mkdir -p $PREFIX/visit/ && \
mkdir -p $PREF/visit/ && \
cd /tmp/software/ && \
chmod 755 /tmp/software/visit-install2_13_3 && \
(echo 1) | bash ./visit-install2_13_3 2.13.3 linux-x86_64-ubuntu18-wmesa $PREFIX/visit/
chmod 755 ./visit-install2_13_3 && \
(echo 1) | bash ./visit-install2_13_3 2.13.3 linux-x86_64-ubuntu18-wmesa $PREF/visit/
# Removing installation packages
RUN rm -rf /tmp/software/
# Copying sample files
COPY ./sample /root/sample
# Run bash when the container launches
CMD ["/bin/bash"]
......@@ -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:
```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.
At this point you can run the workflow for fingerprinting and visualizing defects on the sample dataset inside the Docker container:
```shell
cd /root/sample/
python3 FaVaD.py -p /root/sample/parameters.txt
cd /home/favad/sample/
python3 FaVaD.py -p /home/favad/sample/parameters.txt
```
---
......
......@@ -113,10 +113,10 @@ echo
echo "Build complete!"
echo
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 " cd /root/sample/"
echo " python3 FaVaD.py -p /root/sample/parameters.txt"
echo " cd /home/favad/sample/"
echo " python3 FaVaD.py -p /home/favad/sample/parameters.txt"
echo
# Disarming trap and exit
......
......@@ -6,36 +6,36 @@
# General Parameters
####################
# Output folder
OUTPUT_PATH = /root/sample/output/
OUTPUT_PATH = /home/favad/sample/output/
####################
# Calculation of DVs
####################
# 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)
QUIP_XYZ = /root/sample/input/fe_sample.xyz
QUIP_XYZ = /home/favad/sample/input/fe_sample.xyz
# Input reference descriptor vectors
BCC_VEC = /root/sample/input/bcc_vector.dat
INT_VEC = /root/sample/input/interstitial_vector.dat
VAC_VEC = /root/sample/input/vacancy_vector.dat
TYPA_VEC = /root/sample/input/typea_vector.dat
BCC_VEC = /home/favad/sample/input/bcc_vector.dat
INT_VEC = /home/favad/sample/input/interstitial_vector.dat
VAC_VEC = /home/favad/sample/input/vacancy_vector.dat
TYPA_VEC = /home/favad/sample/input/typea_vector.dat
# 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
##########################################
# 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
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
KDTREE_THR = 3.00
......@@ -44,12 +44,12 @@ KDTREE_THR = 3.00
# Visualization
###############
# Path to visit executable
VISIT_PATH = /root/software/visit/bin/visit
VISIT_PATH = /home/favad/software/visit/bin/visit
# 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
VIS_NAME = fe_sample
# Path to the bash script for the movie creation
MOVIE_SCRIPT = /root/sample/input/movie.sh
MOVIE_SCRIPT = /home/favad/sample/input/movie.sh
Markdown is supported
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