Skip to content

Commit

Permalink
Merge pull request #105 from nmfs-opensci/eeholmes-dev-1
Browse files Browse the repository at this point in the history
add check for postbuild
  • Loading branch information
eeholmes authored Oct 26, 2024
2 parents bed4407 + f269223 commit 01601b5
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions appendix
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,32 @@ ONBUILD RUN echo "Checking for 'install.R" \
# If a start file exists, put that under ${REPO_DIR}/childimage/start.
# This is sourced in ${REPO_DIR}/start
ONBUILD RUN echo "Checking for 'start'..." \
; cd "${REPO_DIR}/childimage/" \
; [ -d binder ] && cd binder \
; [ -d .binder ] && cd .binder \
; if test -f "start" ; then \
chmod +x start \
&& cp start ${REPO_DIR}/childimage/start \
; fi

# If a postBuild file exists, run it!
# After it's done, we try to remove any possible cruft commands there
# leave behind under $HOME - particularly stuff that jupyterlab extensions
# leave behind.
ONBUILD RUN echo "Checking for 'postBuild'..." \
; cd "${REPO_DIR}/childimage/" \
; [ -d binder ] && cd binder \
; [ -d .binder ] && cd .binder \
; if test -f "postBuild" ; then \
chmod +x postBuild \
&& ./postBuild \
&& rm -rf /tmp/* \
&& rm -rf ${HOME}/.cache ${HOME}/.npm ${HOME}/.yarn \
&& rm -rf ${NB_PYTHON_PREFIX}/share/jupyter/lab/staging \
&& find ${CONDA_DIR} -follow -type f -name '*.a' -delete \
&& find ${CONDA_DIR} -follow -type f -name '*.js.map' -delete \
; fi

# Revert to default user and home as pwd
USER ${NB_USER}
WORKDIR ${HOME}

0 comments on commit 01601b5

Please sign in to comment.