Skip to content
Snippets Groups Projects
Verified Commit 17d92a57 authored by David Hoese's avatar David Hoese
Browse files

Fix buildbucket image creation to work better with conda

parent 19f74193
No related branches found
No related tags found
No related merge requests found
# To build:
# docker build -t gitlab.ssec.wisc.edu:5555/cspp_geo/cspp-geo-gridded-glm/buildbucket .
# docker build -t gitlab.ssec.wisc.edu:5555/cspp_geo/cspp-geo-gridded-glm/buildbucket:r$(date '+%Y%m%d') .
FROM centos:7
WORKDIR /work
......@@ -7,12 +7,14 @@ 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 (copied from https://hub.docker.com/r/continuumio/miniconda3/dockerfile)
RUN /bin/bash miniconda.sh -b -p $HOME/miniconda && \
ln -s /opt/conda/etc/profile.d/conda.sh /etc/profile.d/conda.sh && \
echo ". /opt/conda/etc/profile.d/conda.sh" >> ~/.bashrc && \
# Install the `which` command for debugging
RUN yum -y install which git && yum clean all
# Download and install miniconda
# Copied from https://hub.docker.com/r/continuumio/miniconda3/dockerfile)
RUN curl -o miniconda.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh && \
/bin/bash miniconda.sh -b -p $HOME/miniconda && \
ln -s $HOME/miniconda/etc/profile.d/conda.sh /etc/profile.d/conda.sh && \
echo ". $HOME/miniconda/etc/profile.d/conda.sh" >> ~/.bashrc && \
echo "conda activate base" >> ~/.bashrc
RUN /bin/bash -c "$HOME/miniconda/bin/conda env create -n build -f buildbucket_environment.yaml"
......@@ -5,4 +5,18 @@ environment for the Gridded GLM tool.
## Built Bucket Creation Instructions
TODO
\ No newline at end of file
The below commands will build the buildbucket image, tagged with the current
date, and then push it to the container registry on gitlab.
```bash
docker build -t gitlab.ssec.wisc.edu:5555/cspp_geo/cspp-geo-gridded-glm/buildbucket:r$(date '+%Y%m%d') .
docker push gitlab.ssec.wisc.edu:5555/cspp_geo/cspp-geo-gridded-glm/buildbucket:r$(date '+%Y%m%d')
```
After testing the image you can tag it as latest by doing:
```bash
docker tag gitlab.ssec.wisc.edu:5555/cspp_geo/cspp-geo-gridded-glm/buildbucket:r$(date '+%Y%m%d') gitlab.ssec.wisc.edu:5555/cspp_geo/cspp-geo-gridded-glm/buildbucket:latest
docker push gitlab.ssec.wisc.edu:5555/cspp_geo/cspp-geo-gridded-glm/buildbucket:latest
```
#!/usr/bin/env bash
#!/bin/bash -le
# purpose: Create package and place it in /dock
# requires: /gridded_glm to be mounted with package contents (gridded_glm in repository)
set -ex
# note: The shebang at the top of this file is needed as-is. The '-l' will
# load the .bashrc which allows us to use conda. The '-e' triggers exit
# on error behavior. We cannot use '/usr/bin/env bash -le' since most
# linux versions only parse the first two arguments of a shebang.
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
elif [ $# -eq 3 ]; then
version=$1
lmatools_ref=minvaluegrids
glmtools_ref=ugf-newgrid
else
echo $USAGE
echo "Usage: package.sh vX.Y.Z [lmatools_ref glmtools_ref]"
exit 1
fi
# conda activate build
conda activate build
# Debug Info
which python
......@@ -27,6 +29,10 @@ echo "Version specified: ${version}"
echo "lmatools reference: ${lmatools_ref}"
echo "glmtools reference: ${glmtools_ref}"
# Turn on command printing here because we don't need all of the `conda`
# internal bash commands to pollute our output
set -x
# Install glmtools and related packages
# All dependencies should have been built with the buildbucket
# Careful: Could result in missing dependencies but we want reproducibility
......@@ -35,7 +41,7 @@ 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_tb=conda_lmatools-${lmatools_ref}_glmtools-${glmtools_ref}.tar.gz
conda pack -n build -o ${conda_tb}
# Build up our package directory
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment