Skip to content

Commit

Permalink
Merge pull request #6 from carbonplan/repo2docker_tmp
Browse files Browse the repository at this point in the history
add dockerfile and build.yaml
  • Loading branch information
tykukla authored Aug 30, 2024
2 parents 5e0963d + 26b55e2 commit 35402fa
Show file tree
Hide file tree
Showing 2 changed files with 109 additions and 0 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -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"
62 changes: 62 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 35402fa

Please sign in to comment.