mirror of
https://github.com/mveril/qp-demo
synced 2024-08-24 21:41:47 +02:00
Custom branch for compiled version
This commit is contained in:
parent
e61a9d831d
commit
6c8d0e8cc3
90
Dockerfile
90
Dockerfile
@ -1,76 +1,24 @@
|
||||
# For help about how Dockerfiles work, see https://docs.docker.com/engine/reference/builder
|
||||
ARG UBUNTU_VERSION=24.04
|
||||
FROM ubuntu:${UBUNTU_VERSION} AS builder
|
||||
FROM ubuntu:${UBUNTU_VERSION}
|
||||
|
||||
# Build argument (can be changed at build time)
|
||||
# This argument defines the timezone for tzdata required by qp_run
|
||||
ARG tz=Etc/UTC
|
||||
ARG user=user
|
||||
|
||||
# Install all required packages
|
||||
# Install all required packages for building and running
|
||||
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
|
||||
git \
|
||||
curl wget python3 gfortran gcc g++ build-essential unzip liblapack-dev pkg-config autoconf zlib1g zlib1g-dev libgmp-dev libzmq3-dev bzip2 ninja-build libhdf5-dev hdf5-tools file
|
||||
|
||||
# Add user and switch to this user
|
||||
RUN adduser --disabled-password --gecos '' builder
|
||||
USER builder
|
||||
|
||||
# I don't know why but the USER environment variable is not set so I set it because it's required for ninja
|
||||
ENV USER=builder
|
||||
|
||||
# Go to home
|
||||
WORKDIR /home/builder
|
||||
|
||||
# Download quantum package
|
||||
RUN git clone --depth 1 --branch v2.2.2 https://github.com/QuantumPackage/qp2
|
||||
|
||||
# Go to quantum package
|
||||
WORKDIR /home/builder/qp2
|
||||
|
||||
# Configure
|
||||
RUN ./configure -i trexio ; ./configure -i f77zmq ; \
|
||||
./configure -i ocaml ; ./configure -i docopt ;\
|
||||
./configure -i resultsFile
|
||||
RUN ./configure -c config/gfortran_avx.cfg
|
||||
|
||||
# source don't work with /bin/sh (used by the run command so I use bash)
|
||||
# Compile the code to a static build
|
||||
RUN ["/bin/bash", "-c", "source quantum_package.rc ; qp export_as_tgz"]
|
||||
|
||||
# Used to unpack QP2
|
||||
FROM busybox AS unpack
|
||||
WORKDIR /tmp
|
||||
COPY --from=builder /home/builder/qp2/quantum_package_static.tar.gz .
|
||||
RUN tar -xf quantum_package_static.tar.gz
|
||||
|
||||
# This image is based from Ubuntu LTS
|
||||
FROM ubuntu:${UBUNTU_VERSION}
|
||||
LABEL version="2.2.2" \
|
||||
maintainer.name="Mickaël Véril" \
|
||||
quantum_package.author.name="Anthony Scemama" \
|
||||
quantum_package.url="https://quantumpackage.github.io/qp2" \
|
||||
quantum_package.repo="https://github.com/QuantumPackage/qp2" \
|
||||
quantum_package.demo.repo="https://github.com/mveril/qp-demo" \
|
||||
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)
|
||||
# This argument defines the user name
|
||||
ARG user=user
|
||||
# This argument defines the timezone for tzdata required by qp_run
|
||||
ARG tz=Etc/UTC
|
||||
|
||||
# Unminimize and install all required packages
|
||||
RUN yes | unminimize && apt-get update && \
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y \
|
||||
python3 htop vim emacs-nox screen tmux less wget curl tzdata man manpages-posix lsb-release hdf5-tools \
|
||||
curl wget python3 gfortran gcc g++ build-essential unzip liblapack-dev pkg-config autoconf zlib1g zlib1g-dev libgmp-dev libzmq3-dev bzip2 ninja-build libhdf5-dev hdf5-tools file \
|
||||
htop vim emacs-nox screen tmux less tzdata man manpages-posix lsb-release \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Reconfigure tzdata with the correct timezone
|
||||
RUN echo $tz > /etc/timezone && rm -rf /etc/localtime && echo "set mouse=" > ~/.vimrc
|
||||
RUN dpkg-reconfigure -f noninteractive tzdata
|
||||
RUN echo $tz > /etc/timezone && rm -rf /etc/localtime && ln -snf /usr/share/zoneinfo/$tz /etc/localtime && dpkg-reconfigure -f noninteractive tzdata
|
||||
|
||||
# Add user and switch to this user
|
||||
ARG user=user
|
||||
RUN adduser --disabled-password --gecos '' $user
|
||||
USER $user
|
||||
|
||||
@ -80,15 +28,29 @@ ENV USER=$user
|
||||
# Go to home
|
||||
WORKDIR /home/$user
|
||||
|
||||
# Download quantum package
|
||||
RUN git clone --depth 1 --branch v2.2.2 https://github.com/QuantumPackage/qp2
|
||||
|
||||
# Go to quantum package
|
||||
WORKDIR /home/$user/qp2
|
||||
|
||||
# Configure
|
||||
RUN ./configure -i trexio ; ./configure -i f77zmq ; \
|
||||
./configure -i ocaml ; ./configure -i docopt ; \
|
||||
./configure -i resultsFile
|
||||
RUN ./configure -c config/gfortran_avx.cfg
|
||||
|
||||
# Compile the code
|
||||
RUN ["/bin/bash", "-c", "source quantum_package.rc ; ninja"]
|
||||
|
||||
WORKDIR /home/$user
|
||||
|
||||
# Copy examples
|
||||
COPY --chown=$user examples examples
|
||||
|
||||
# Copy unpacked QP2 static
|
||||
COPY --from=unpack --chown=$user /tmp/quantum_package_static qp2
|
||||
|
||||
# Prepare tmux and screen to use QPSH
|
||||
RUN echo "set -g default-command /home/$user/qp2/bin/qpsh" >> .tmux.conf
|
||||
RUN echo "shell \"/home/$user/qp2/bin/qpsh\"" >> .screenrc
|
||||
RUN echo "set -g default-command /home/$user/qp2/bin/qpsh" >> /home/$user/.tmux.conf
|
||||
RUN echo "shell \"/home/$user/qp2/bin/qpsh\"" >> /home/$user/.screenrc
|
||||
|
||||
# Start a qp shell when run
|
||||
CMD ["./qp2/bin/qpsh"]
|
||||
|
Loading…
Reference in New Issue
Block a user