Skip to content

Commit

Permalink
Merge pull request #92 from sot/build-image
Browse files Browse the repository at this point in the history
Update docker image to use testr and ska_helpers
  • Loading branch information
javierggt authored Jan 3, 2023
2 parents a007219 + c9b27de commit f36c520
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 10 deletions.
2 changes: 1 addition & 1 deletion docker/centos7-builder/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ RUN curl -O https://repo.anaconda.com/miniconda/Miniconda3-py38_4.8.3-Linux-x86_
# CONDA_PASSWORD must be passed as argument
ARG CONDA_PASSWORD
RUN : "${CONDA_PASSWORD:?Conda password must be given at build time (e.g. --build-arg CONDA_PASSWORD=\$CONDA_PASSWORD).}" && \
conda create -y -n ska-builder setuptools_scm gitpython conda-build jinja2 pyyaml python=3.8 numpy
conda create -y -n ska-builder setuptools_scm gitpython conda-build jinja2 pyyaml python=3.8 numpy testr ska_helpers


# using a different INVALIDATE_CACHE value invalidates the cache here (--build-arg INVALIDATE_CACHE=...)
Expand Down
37 changes: 29 additions & 8 deletions docker/centos7-builder/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,39 @@ Skare3 Conda Package Builder Image

The built package can be found in the [repository packages](https://github.com/sot/skare3/packages).

To build this:

docker build -t docker.pkg.github.com/sot/skare3/centos7-builder:v1 --build-arg CONDA_PASSWORD=<password> .
Updating the package
--------------------

Authenticate:
To update the package, you build it locally and then upload it to the repository.

echo $GITHUB_TOKEN | docker login https://docker.pkg.github.com -u USERNAME --password-stdin
### Build:

Upload:
Check what is the latest version, make sure you choose a different one. The CONDA_PASSWORD in this step is the one to access the conda repo on cxc.

docker push docker.pkg.github.com/sot/skare3/centos7-builder:v1
docker build -t docker.pkg.github.com/sot/skare3/centos7-builder:<version> --build-arg CONDA_PASSWORD=<password> .

Run:
### Test:

docker run -v /path/to/my/work/dir:/work -it --rm docker.pkg.github.com/sot/skare3/centos7-builder:v1
To test, choose a repository to build (e.g. sot/ska_sun) and a tag (can be a commit hash). Use your github username and token in this step (the one used in CI is set in the workflow and secrets):

export GIT_USERNAME=<username>
export GIT_PASSWORD=$GITHUB_TOKEN
mkdir workspace
docker run --rm -v `pwd`/workspace:/github/workspace -w /github/workspace -e CONDA_PASSWORD -e GIT_USERNAME -e GIT_PASSWORD docker.pkg.github.com/sot/skare3/centos7-builder:<version> <repository> --tag <tag>

### Authenticate:

You need a Github token with permission to upload packages (a classic token with write:packages scope will do).

echo $GITHUB_TOKEN | docker login https://docker.pkg.github.com -u <username> --password-stdin

### Upload:

docker tag docker.pkg.github.com/sot/skare3/centos7-builder:<version> docker.pkg.github.com/sot/skare3/centos7-builder:latest
docker push docker.pkg.github.com/sot/skare3/centos7-builder:<version>
docker push docker.pkg.github.com/sot/skare3/centos7-builder:latest

### Run interactively:

docker run -v /path/to/my/work/dir:/work -it --rm docker.pkg.github.com/sot/skare3/centos7-builder:<version>
2 changes: 1 addition & 1 deletion docker/centos7-builder/files/condarc.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
binstar_upload: false
channels:
- https://ska:${CONDA_PASSWORD}@cxc.cfa.harvard.edu/mta/ASPECT/ska3-conda/shiny
- https://ska:${CONDA_PASSWORD}@cxc.cfa.harvard.edu/mta/ASPECT/ska3-conda/flight
- defaults

0 comments on commit f36c520

Please sign in to comment.