diff --git a/buildbucket/Dockerfile b/buildbucket/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..a636f48715c1ed6b88f7dcbda9168cdb61795873 --- /dev/null +++ b/buildbucket/Dockerfile @@ -0,0 +1,16 @@ +FROM centos:7 + +WORKDIR /work + +COPY buildbucket_environment.yaml . +COPY package.sh . + +# Download miniconda +RUN curl -o miniconda.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh +# Install miniconda +RUN bash miniconda.sh -b -p $HOME/miniconda + +ENV PATH $HOME/miniconda/bin:$PATH +RUN conda env create -y -n build -f buildbucket_environment.yaml +RUN conda activate build + diff --git a/buildbucket/buildbucket_environment.yaml b/buildbucket/buildbucket_environment.yaml new file mode 100644 index 0000000000000000000000000000000000000000..35f6874e6875229baef478da16edef747ef4b72e --- /dev/null +++ b/buildbucket/buildbucket_environment.yaml @@ -0,0 +1,19 @@ +name: gridded_glm_buildbucket +channels: + - conda-forge +dependencies: + - conda-pack + - curl + - dask + - distributed + - netcdf4 + - pip + - pyclipper + - pyproj + - pytables + - python=3.7 + - pyyaml + - scipy + - setuptools + - xarray + - zarr \ No newline at end of file diff --git a/buildbucket/package.sh b/buildbucket/package.sh new file mode 100644 index 0000000000000000000000000000000000000000..74104c14de8f2d0562af960e3dded116bf30c82f --- /dev/null +++ b/buildbucket/package.sh @@ -0,0 +1,57 @@ +#!/usr/bin/env bash +# purpose: Create package and place it in /dock +# requires: /gridded_glm to be mounted with package contents (gridded_glm in repository) +set -ex + +USAGE="Usage: package.sh vX.Y.Z [lmatools_ref glmtools_ref]" +if [ $# -eq 1 ]; then + version=$1 + lmatools_ref=minvaluegrids + glmtools_ref=ugf-newgrid +else if [ $# -eq 3 ]; then + version=$1 + lmatools_ref=minvaluegrids + glmtools_ref=ugf-newgrid +else + echo $USAGE + exit 1 +fi + +# conda activate build + +# Debug Info +which python +conda info -a +conda list --export +echo "Version specified: ${version}" +echo "lmatools reference: ${lmatools_ref}" +echo "glmtools reference: ${glmtools_ref}" + +# Install glmtools and related packages +# All dependencies should have been built with the buildbucket +# Careful: Could result in missing dependencies but we want reproducibility +pip install --no-deps git+https://github.com/deeplycloudy/lmatools.git@${lmatools_ref} +pip install --no-deps git+https://github.com/deeplycloudy/stormdrain.git +pip install --no-deps git+https://github.com/deeplycloudy/glmtools.git@${glmtools_ref} + +# Build a tarball version of the current conda environment +conda_tb=conda_lmatools-${lmatools}_glmtools-${glmtools_ref}.tar.gz +conda pack -n build -o ${conda_tb} + +# Build up our package directory +pkg_name=cspp_geo_gridded_glm-${version} +mkdir -p ${pkg_name} +cd ${pkg_name} +mkdir -p bin opt/conda +# Copy package scripts/data to package directory +cp /gridded_glm/PACKAGE_README.md ./README.md +cp /gridded_glm/bin/* ./bin/ +# Untar the tarball so we can put things where we want +tar -xz -C ./opt/conda -f ../${conda_tb} +# Go back to original work directory +cd .. + +# Create tarball of package directory +tar -czf ${pkg_name}.tar.gz ${pkg_name} +mv ${pkg_name}.tar.gz /dock/ + diff --git a/gridded_glm/PACKAGE_README.md b/gridded_glm/PACKAGE_README.md new file mode 100644 index 0000000000000000000000000000000000000000..c04e3534941e05fc15aa6e571f9ccc3dfe096a21 --- /dev/null +++ b/gridded_glm/PACKAGE_README.md @@ -0,0 +1,3 @@ +# CSPP Geo Gridded GLM + +TODO \ No newline at end of file diff --git a/gridded_glm/bin/run.sh b/gridded_glm/bin/run.sh new file mode 100644 index 0000000000000000000000000000000000000000..585000289f217e4bba026123360d725feccca5e5 --- /dev/null +++ b/gridded_glm/bin/run.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +echo "TODO" +exit 1 \ No newline at end of file