Skip to content

Commit

Permalink
Better caching
Browse files Browse the repository at this point in the history
  • Loading branch information
danielhollas committed Jul 18, 2024
1 parent 3f20583 commit 9c64aaf
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ RUN mamba create -p /opt/conda/envs/quantum-espresso --yes \
ln -s /opt/conda/envs/quantum-espresso /home/${NB_USER}/.conda/envs/quantum-espresso-${QE_VERSION} && \
mamba clean --all -f -y

# 2. Copy the whole repo
ENV QE_APP_FOLDER=${AIIDALAB_APPS}/quantum-espresso
COPY --chown=${NB_UID}:${NB_GID} . ${QE_APP_FOLDER}
# 2. Copy files needed for installing stuff, the rest is copied at the end for better caching
COPY --chown=${NB_UID}:${NB_GID} src/ ${QE_APP_FOLDER}/src
COPY --chown=${NB_UID}:${NB_GID} setup.cfg pyproject.toml *yaml README.md ${QE_APP_FOLDER}

WORKDIR "${QE_APP_FOLDER}"
# 3.Install python dependencies
Expand All @@ -25,8 +26,6 @@ WORKDIR "${QE_APP_FOLDER}"
# Use the same constraint file as pip
ENV UV_CONSTRAINT=${PIP_CONSTRAINT}
RUN --mount=from=uv,source=/uv,target=/bin/uv \
# Remove all untracked files and directories.
git clean -dffx && \
uv pip install --system --no-cache .

# 4. Prepare AiiDA profile and localhost computer
Expand All @@ -38,6 +37,12 @@ RUN bash /usr/local/bin/before-notebook.d/20_start-postgresql.sh && \
verdi daemon stop && \
mamba run -n aiida-core-services pg_ctl stop


# 6. Copy the whole repo
COPY --chown=${NB_UID}:${NB_GID} . ${QE_APP_FOLDER}
# Remove all untracked files and directories.
RUN git clean -dffx

USER root
COPY ./before-notebook.d/* /usr/local/bin/before-notebook.d/
RUN fix-permissions "${CONDA_DIR}" && \
Expand Down

0 comments on commit 9c64aaf

Please sign in to comment.