diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..8db4d4b --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,47 @@ + + +name: Build and push container image + +on: + push: + branches: + - main + pull_request: + +jobs: + test-build: + runs-on: ubuntu-latest + + steps: + + + # For biggish images, github actions runs out of disk space. + # So we cleanup some unwanted things in the disk image, and reclaim that space for our docker use + # https://github.com/actions/virtual-environments/issues/2606#issuecomment-772683150 + # and https://github.com/easimon/maximize-build-space/blob/b4d02c14493a9653fe7af06cc89ca5298071c66e/action.yml#L104 + # This gives us a total of about 52G of free space, which should be enough for now + - name: cleanup disk space + run: | + sudo rm -rf /usr/local/lib/android /usr/share/dotnet /opt/ghc + df -h + + - name: Set Environment Variables + run: | + + echo "DATE_TAG=$(TZ='America/Seattle' date +'%Y.%m.%d')" >> "$GITHUB_ENV" + + - name: Checkout files in repo + uses: actions/checkout@main + + - name: Build and push the image to quay.io ${{ matrix.environment }} + uses: jupyterhub/repo2docker-action@master + with: + # Make sure username & password/token pair matches your registry credentials + DOCKER_USERNAME: ${{ secrets.QUAY_USERNAME }} + DOCKER_PASSWORD: ${{ secrets.QUAY_PASSWORD }} + DOCKER_REGISTRY: "quay.io" + ADDITIONAL_TAG: ${{ env.DATE_TAG }} + # Disable pushing a 'latest' tag, as this often just causes confusion + # LATEST_TAG_OFF: true + + IMAGE_NAME: "carbonplan/aglime-swap-cdr" diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..9f34eb1 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,62 @@ +# FROM quay.io/nebari/nebari-jupyterlab:2024.3.2 +# Trying to build off a sort minimal jupyter image. This gives us the ability to run notebooks. +# Is this something the average crunchtope user would want? + +# FROM quay.io/jupyter/minimal-notebook +# this fails on the coiled deployment b/c distribued is missing: + +FROM quay.io/jupyter/scipy-notebook + + +USER root + +RUN apt-get update && apt-get install -y --no-install-recommends \ + wget \ + gfortran \ + gcc \ + g++ \ + # git \ # should be covered by base + make \ + # python3 \ # should be covered by base + # python3-pip \ # should be covered by base + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +ENV PETSC_DIR=/opt/petsc-3.15.5 +ENV PETSC_ARCH=linux-gnu-opt +ENV PATH=$PATH:/opt/crunch/source + +WORKDIR /opt +RUN wget https://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-3.15.5.tar.gz \ + && tar -xzf petsc-3.15.5.tar.gz \ + && cd petsc-3.15.5 \ + && ./configure --with-cc=gcc --with-cxx=g++ --with-fc=gfortran --download-fblaslapack --with-mpi=0 --with-debugging=0 --with-shared-libraries=0 --with-x=0 PETSC_ARCH=linux-gnu-opt \ + && make PETSC_DIR=/opt/petsc-3.15.5 PETSC_ARCH=linux-gnu-opt all \ + && rm /opt/petsc-3.15.5.tar.gz \ + && make PETSC_DIR=/opt/petsc-3.15.5 PETSC_ARCH=linux-gnu-opt check + +# Clone and build CrunchFlow +WORKDIR /opt +RUN git clone https://bitbucket.org/crunchflow/crunchtope-dev.git \ + && mkdir -p /opt/crunch \ + && mv crunchtope-dev/source /opt/crunch/ \ + && cd /opt/crunch/source \ + && make + +# Clean up +RUN apt-get clean && \ + rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +# Set up permissions for the default Jupyter user +RUN mkdir -p /home/jovyan/work && \ + chown -R 1000:100 /home/jovyan && \ + chmod -R 775 /home/jovyan + +# Set working directory +WORKDIR /home/jovyan/work + +# Ensure the PATH is updated for all users +ENV PATH=$PATH:/opt/crunch/source + +# Switch back to the default Jupyter user +USER 1000