2019-11-06 14:40:50 +01:00
|
|
|
# For help about how Dockerfiles work, see https://docs.docker.com/engine/reference/builder
|
2024-06-01 14:31:00 +02:00
|
|
|
ARG UBUNTU_VERSION=24.04
|
2024-06-01 15:19:03 +02:00
|
|
|
FROM ubuntu:${UBUNTU_VERSION}
|
2024-06-01 14:31:00 +02:00
|
|
|
|
|
|
|
# Build argument (can be changed at build time)
|
|
|
|
# This argument defines the timezone for tzdata required by qp_run
|
2021-04-30 13:05:57 +02:00
|
|
|
ARG tz=Etc/UTC
|
2024-06-01 15:19:03 +02:00
|
|
|
ARG user=user
|
2024-06-01 14:31:00 +02:00
|
|
|
|
2024-06-01 15:19:03 +02:00
|
|
|
# Install all required packages for building and running
|
2021-05-04 12:29:00 +02:00
|
|
|
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
|
2024-06-01 14:31:00 +02:00
|
|
|
git \
|
2024-06-01 15:19:03 +02:00
|
|
|
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 && ln -snf /usr/share/zoneinfo/$tz /etc/localtime && dpkg-reconfigure -f noninteractive tzdata
|
2024-06-01 14:31:00 +02:00
|
|
|
|
2021-04-30 13:05:57 +02:00
|
|
|
# Add user and switch to this user
|
2024-06-01 15:19:03 +02:00
|
|
|
ARG user=user
|
|
|
|
RUN adduser --disabled-password --gecos '' $user
|
|
|
|
USER $user
|
2024-06-01 14:31:00 +02:00
|
|
|
|
|
|
|
# I don't know why but the USER environment variable is not set so I set it because it's required for ninja
|
2024-06-01 15:19:03 +02:00
|
|
|
ENV USER=$user
|
2024-06-01 14:31:00 +02:00
|
|
|
|
2021-04-30 13:05:57 +02:00
|
|
|
# Go to home
|
2024-06-01 15:19:03 +02:00
|
|
|
WORKDIR /home/$user
|
2024-06-01 14:31:00 +02:00
|
|
|
|
2021-04-30 13:05:57 +02:00
|
|
|
# Download quantum package
|
2024-06-01 14:31:00 +02:00
|
|
|
RUN git clone --depth 1 --branch v2.2.2 https://github.com/QuantumPackage/qp2
|
|
|
|
|
2021-04-30 13:05:57 +02:00
|
|
|
# Go to quantum package
|
2024-06-01 15:19:03 +02:00
|
|
|
WORKDIR /home/$user/qp2
|
2024-06-01 14:31:00 +02:00
|
|
|
|
2021-04-30 13:05:57 +02:00
|
|
|
# Configure
|
2024-06-01 15:19:03 +02:00
|
|
|
RUN ./configure -i trexio ; ./configure -i f77zmq ; \
|
|
|
|
./configure -i ocaml ; ./configure -i docopt ; \
|
2024-06-01 14:31:00 +02:00
|
|
|
./configure -i resultsFile
|
|
|
|
RUN ./configure -c config/gfortran_avx.cfg
|
|
|
|
|
2024-06-01 15:19:03 +02:00
|
|
|
# Compile the code
|
|
|
|
RUN ["/bin/bash", "-c", "source quantum_package.rc ; ninja"]
|
2024-06-01 14:31:00 +02:00
|
|
|
|
2019-11-06 14:40:50 +01:00
|
|
|
WORKDIR /home/$user
|
2024-06-01 14:31:00 +02:00
|
|
|
|
2021-04-30 13:05:57 +02:00
|
|
|
# Copy examples
|
2021-05-04 12:58:04 +02:00
|
|
|
COPY --chown=$user examples examples
|
2024-06-01 14:31:00 +02:00
|
|
|
|
2021-05-04 12:58:04 +02:00
|
|
|
# Prepare tmux and screen to use QPSH
|
2024-06-01 15:19:03 +02:00
|
|
|
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
|
2019-11-06 14:40:50 +01:00
|
|
|
|
2024-06-01 14:31:00 +02:00
|
|
|
# Start a qp shell when run
|
|
|
|
CMD ["./qp2/bin/qpsh"]
|