Skip to content

Commit

Permalink
feat: Expose caustics repo option for custom repo
Browse files Browse the repository at this point in the history
  • Loading branch information
lsetiawan committed Feb 14, 2024
1 parent d829226 commit b5ecfc4
Showing 1 changed file with 19 additions and 14 deletions.
33 changes: 19 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -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}
Expand All @@ -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

Expand All @@ -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}" ; \
Expand Down

0 comments on commit b5ecfc4

Please sign in to comment.