From b5ecfc45e215c67e3bc7096c7e437fc4aa1ce740 Mon Sep 17 00:00:00 2001 From: Landung 'Don' Setiawan Date: Wed, 14 Feb 2024 10:01:54 -0800 Subject: [PATCH] feat: Expose caustics repo option for custom repo --- Dockerfile | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/Dockerfile b/Dockerfile index a2a3a32..2471596 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,6 +2,7 @@ ARG CUDA_VERSION=11.8.0 FROM mambaorg/micromamba:focal-cuda-${CUDA_VERSION} ARG CAUSTICS_VERSION=0.7.0 +ARG CAUSTICS_REPO="https://github.com/Ciela-Institute/caustics.git" # Tell apt-get to not block installs by asking for interactive human input ENV DEBIAN_FRONTEND=noninteractive \ @@ -11,17 +12,13 @@ ENV DEBIAN_FRONTEND=noninteractive \ # Set caustics directory home # this will be empty if not in dev mode CAUSTICS_HOME=/opt/caustics \ - CAUSTICS_REPO="https://github.com/Ciela-Institute/caustics.git" \ CAUSTICS_TEST_SCRIPT=/usr/local/bin/run-tests # Switch over to root user to install apt-get packages USER root -# Setup caustics directory in case we are working with -# dev repo -RUN echo "Setup caustics directory..." \ - && mkdir ${CAUSTICS_HOME} \ - && chown -R $MAMBA_USER:$MAMBA_USER ${CAUSTICS_HOME} +# Make everything in opt rootless +RUN chown -R ${MAMBA_USER}:${MAMBA_USER} /opt # Copy over run test script for the case we are working with dev repo COPY --chown=$MAMBA_USER:$MAMBA_USER run-tests.sh ${CAUSTICS_TEST_SCRIPT} @@ -33,18 +30,26 @@ RUN echo "Installing Apt-get packages..." \ && apt-get update --fix-missing > /dev/null \ && apt-get install -y apt-utils \ && apt-get install -y \ - git \ - wget \ - zip \ - tzdata \ - python3-venv \ - graphviz > /dev/null \ + git \ + wget \ + zip \ + tzdata \ + vim \ + tmux \ + python3-venv \ + graphviz > /dev/null \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* # Switch back to mamba user after all apt-get packages are installed USER $MAMBA_USER +# Setup caustics directory in case we are working with +# dev repo +RUN echo "Setup caustics directory..." \ + && mkdir ${CAUSTICS_HOME} \ + && chown -R $MAMBA_USER:$MAMBA_USER ${CAUSTICS_HOME} + # Copy over the conda lock file from host machine to docker build engine COPY --chown=$MAMBA_USER:$MAMBA_USER conda-linux-64.lock /tmp/conda-linux-64.lock @@ -57,9 +62,9 @@ ARG MAMBA_DOCKERFILE_ACTIVATE=1 # Install caustics from a branch or distribution RUN echo "Installing caustics ..." \ - ; if [ "${CAUSTICS_VERSION}" == "dev" ]; then \ + ; if [[ "${CAUSTICS_VERSION}" = *"dev"* ]]; then \ echo "Cloning caustics to ${CAUSTICS_HOME}..." ; \ - git clone -b ${CAUSTICS_VERSION} --single-branch https://github.com/Ciela-Institute/caustics.git ${CAUSTICS_HOME} ; \ + git clone -b ${CAUSTICS_VERSION} --single-branch ${CAUSTICS_REPO} ${CAUSTICS_HOME} ; \ echo "Installing from github branch: ${CAUSTICS_VERSION}..." ; \ pip install --no-cache "${CAUSTICS_HOME}[dev]" \ ; else echo "Installing from production distribution version: ${CAUSTICS_VERSION}" ; \