From c549153442bcb946c2af1928dee9dc629a2e8933 Mon Sep 17 00:00:00 2001 From: Landung 'Don' Setiawan Date: Tue, 13 Feb 2024 14:12:09 -0800 Subject: [PATCH] ci: Change to clone repo and install for dev --- .github/workflows/build.yml | 1 - Dockerfile | 19 ++++++++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c2d605a..ef0c141 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,3 @@ -# Any commit to master branch re-builds images, re-runs tests, and pushes SHA tags to DockerHub name: Build on: pull_request: diff --git a/Dockerfile b/Dockerfile index b42428c..ed50801 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,11 +7,19 @@ ARG CAUSTICS_VERSION=0.7.0 ENV DEBIAN_FRONTEND=noninteractive \ # Setup locale to be UTF-8, avoiding gnarly hard to debug encoding errors LANG=C.UTF-8 \ - LC_ALL=C.UTF-8 + LC_ALL=C.UTF-8 \ + # 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" # Switch over to root user to install apt-get packages USER root +RUN echo "Setup caustics directory..." \ + && mkdir ${CAUSTICS_HOME} \ + && chown -R $MAMBA_USER:$MAMBA_USER ${CAUSTICS_HOME} + # Install basic apt packages RUN echo "Installing Apt-get packages..." \ && apt-get update --fix-missing > /dev/null \ @@ -39,12 +47,13 @@ RUN micromamba install --name base --yes --file /tmp/conda-linux-64.lock \ # Set to activate mamba environment, otherwise python will not be found ARG MAMBA_DOCKERFILE_ACTIVATE=1 -# Install caustics from a branch for now -ENV CAUSTICS_REPO="git+https://github.com/Ciela-Institute/caustics.git@${CAUSTICS_VERSION}" +# Install caustics from a branch or distribution RUN echo "Installing caustics ..." \ ; if [ "${CAUSTICS_VERSION}" == "dev" ]; then \ - echo "Installing from github branch: ${CAUSTICS_VERSION}" \ - && pip install --no-cache ${CAUSTICS_REPO} \ + echo "Cloning caustics to ${CAUSTICS_HOME}..." \ + && git clone -b ${CAUSTICS_VERSION} --single-branch https://github.com/Ciela-Institute/caustics.git ${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}" ; \ pip install caustics==${CAUSTICS_VERSION} \ ; fi