Skip to content

Commit

Permalink
Move QE and pseudo installations to the top of Dockerfile for better …
Browse files Browse the repository at this point in the history
…caching behaviour
  • Loading branch information
danielhollas committed Jul 5, 2024
1 parent e436e1a commit 6751743
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,25 @@
FROM ghcr.io/astral-sh/uv:0.2.18 as uv
FROM base-image

USER ${NB_USER}

ENV QE_VERSION ${QE_VERSION}
RUN mamba create -p /opt/conda/envs/quantum-espresso --yes \
qe=${QE_VERSION} \
&& mamba clean --all -f -y && \
fix-permissions "${CONDA_DIR}" && \
fix-permissions "/home/${NB_USER}"

# Download the QE pseudopotentials to the folder for afterware installation.
ENV PSEUDO_FOLDER ${CONDA_DIR}/pseudo
RUN mkdir -p ${PSEUDO_FOLDER} && \
python -m aiidalab_qe download-pseudos --dest ${PSEUDO_FOLDER}

# Copy whole repo and pre-install the dependencies and app to the tmp folder.
# In the before notebook scripts the app will be re-installed by moving it to the app folder.
ENV PREINSTALL_APP_FOLDER ${CONDA_DIR}/aiidalab-qe
COPY --chown=${NB_UID}:${NB_GID} --from=src . ${PREINSTALL_APP_FOLDER}

USER ${NB_USER}

# Using uv to speed up installation, per docs:
# https://github.com/astral-sh/uv/blob/main/docs/guides/docker.md#using-uv-temporarily
# Use the same constraint file as PIP
Expand All @@ -35,19 +47,6 @@ RUN --mount=from=uv,source=/uv,target=/bin/uv \
ARG APP_VERSION
ENV APP_VERSION ${APP_VERSION}

ARG QE_VERSION
ENV QE_VERSION ${QE_VERSION}
RUN mamba create -p /opt/conda/envs/quantum-espresso --yes \
qe=${QE_VERSION} \
&& mamba clean --all -f -y && \
fix-permissions "${CONDA_DIR}" && \
fix-permissions "/home/${NB_USER}"

# Download the QE pseudopotentials to the folder for afterware installation.
ENV PSEUDO_FOLDER ${CONDA_DIR}/pseudo
RUN mkdir -p ${PSEUDO_FOLDER} && \
python -m aiidalab_qe download-pseudos --dest ${PSEUDO_FOLDER}

COPY before-notebook.d/* /usr/local/bin/before-notebook.d/

WORKDIR "/home/${NB_USER}"

0 comments on commit 6751743

Please sign in to comment.