1
0
mirror of https://github.com/mveril/qp-demo synced 2024-07-22 18:57:32 +02:00
qp-demo/Dockerfile.compile
2019-11-06 14:40:50 +01:00

61 lines
2.3 KiB
Docker

# For help about how Dockerfiles work, see https://docs.docker.com/engine/reference/builder
# This image is based from Ubuntu LTS
FROM ubuntu:latest
LABEL version="0.1" \
maintainer.name="Mickaël Véril" \
maintainer.email="" \
quantum_package.author.name="Anthony Scemama" \
quantum_package.author.email="" \
quantum_package.url="https://quantumpackage.github.io/qp2" \
quantum_package.repo="https://github.com/QuantumPackage/qp2" \
laboratory.name="Laboratoire de Chimie et Physique Quantique (LCPQ)" \
laboratory.url="http://www.lcpq.ups-tlse.fr/"
# Build argument (can be changed at build time see buiild.sh for an example)
# This argument define the user name
ARG user=user
# This argument define timezone for tzdata requierd by qp_run
ARG tz=Etc/UTC
# We could add another argument to configure the language of the image
# Install all requierd packages
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install apt-utils -y
RUN DEBIAN_FRONTEND=noninteractive apt-get install \
# Git for download quantum package
git \
# All necessary packages to compile and run quantum package
curl wget python gfortran gcc g++ build-essential unzip liblapack-dev pkg-config autoconf zlib1g zlib1g-dev tzdata libgmp-dev \
# Other packages for user usage
htop vim emacs screen tmux less man -y
# Reconfigure tzdata with the good timezone
RUN echo $tz > /etc/timezone
RUN rm -rf /etc/localtime
RUN dpkg-reconfigure -f noninteractive tzdata
# ADD user and switch to this user
RUN adduser --disabled-password --gecos '' $user
USER $user
# I don't know why but the USER environment variable is not set so I set it because it's requested for ninja
ENV USER=$user
# Go to home
WORKDIR /home/$user
# Download quantum package
RUN git clone https://github.com/QuantumPackage/qp2
# Go to quantum package
WORKDIR /home/$user/qp2
# Configure
RUN TRAVIS=1 ./configure -i all -c config/gfortran.cfg
# source don't work with /bin/sh (used by the run command so I use bash)
# Compile the code
RUN /bin/bash -c "source quantum_package.rc ; ninja"
# Run tests
RUN /bin/bash -c "source quantum_package.rc ; qp_test -a"
# Return to the user directory
WORKDIR /home/$user/
# Add source to bashrc
RUN echo "source /home/$user/quantum_package/quantum_package.rc" >> ~/.bashrc
## start a login shell when run
#CMD ["/bin/bash","--login"]
# start a qpsh when run
CMD ["/bin/bash","--login", "-c", "qpsh"]