diff --git a/README.md b/README.md index a3cc6da..ae749cc 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,4 @@ +[![img](https://img.shields.io/badge/Lifecycle-Stable-97ca00)](https://github.com/bcgov/repomountie/blob/master/doc/lifecycle-badges.md) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE) # Docker images for Hyperledger Aries Cloud Agent @@ -43,6 +44,15 @@ By default, the tag for a new image will be composed by `$base_image_tag`, follo | py36-1.14-1_0.4.5 | python | von-image:py36-1.14-1 | 0.4.5 | | py36-1.14-1_0.5.0 | python | von-image:py36-1.14-1 | 0.5.0 | | py36-1.14-1_0.5.1 | python | von-image:py36-1.14-1 | 0.5.1 | +| py36-1.15-0_0.5.2 | python | von-image:py36-1.15-0 | 0.5.2 | +| py36-1.15-0_0.5.3 | python | von-image:py36-1.15-0 | 0.5.3 | +| py36-1.15-0_0.5.4 | python | von-image:py36-1.15-0 | 0.5.4 | +| py36-1.15-0_0.5.5 | python | von-image:py36-1.15-0 | 0.5.5 | +| py36-1.15-0_0.5.6 | python | von-image:py36-1.15-0 | 0.5.6 | +| py36-1.15-1_0.6.0 | python | von-image:py36-1.15-1 | 0.6.0 | +| py36-1.16-1_0.7.0 | python | von-image:py36-1.16-1 | 0.7.0 | +| py36-1.16-1_0.7.1 | python | von-image:py36-1.16-1 | 0.7.1 | +| py36-1.16-1_0.7.1 | python | von-image:py36-1.16-1 | 0.7.2-rc0 | # Building the image locally @@ -50,15 +60,30 @@ By default, the tag for a new image will be composed by `$base_image_tag`, follo To build the image locally you will need to install: -- [Python 3](https://www.python.org/) -- [Docker](https://www.docker.com/) +- [Python 3](https://www.python.org/) +- [Docker](https://www.docker.com/) ## Running the build -To build the image, open a terminal session at the root of this Git repo and execute: `python make_image.py python 0.3.0`. -This will build the python version of the image, and include aries-cloudagent version 0.3.0. +To build the image, open a terminal session at the root of this git repo and execute: `python make_image.py 0.3.0 python`, +replacing `0.3.0` with the aries-cloudagent version you need. -Many parameters can be specified through command-line, for more information please type `python make_image.py` to display the command's usage page. +Additional parameters can be specified through command-line, for more information please type `python make_image.py --help` to display the command's usage page. + +## Adding and Publishing a New Image + +To add a new version of aries-cloudagent to this repo, create a PR with the following changes: + +- Decide on the base image to be used for the image, and the version of Aries Cloud Agent. + - The image tag of the output will be a concatenation of the two, as indicated in the table above. +- Update the table in this readme to add the new version. +- Edit the [make_image.py](make_image.py) file in this repo to add the new version. +- Create and test the build of the local image using the options `--no-cache` and `--test` + - `python make_image.py 0.7.2-rc0 --no-cache --test python` +- If successful, push the image to the bcgovimages organization of Docker Hub using the `--push` option + - `python make_image.py 0.7.2-rc0 --push python` +- If successful, verify the publishing of the image by checking [Docker Hub](https://hub.docker.com/r/bcgovimages/aries-cloudagent/tags) + - Note that it make take a few minutes for the new tag to appear. Hit refresh periodically until the image is visible. # Credits diff --git a/make_image.py b/make_image.py index 7100af5..300cbd9 100644 --- a/make_image.py +++ b/make_image.py @@ -92,6 +92,63 @@ "args": { "base_image": "bcgovimages/von-image:py36-1.14-1" }, + }, + { + "version": "0.5.2", + "args": { + "base_image": "bcgovimages/von-image:py36-1.15-0" + }, + }, + { + "version": "0.5.3", + "args": { + "base_image": "bcgovimages/von-image:py36-1.15-0" + }, + }, + { + "version": "0.5.4", + "args": { + "base_image": "bcgovimages/von-image:py36-1.15-0" + }, + }, + { + "version": "0.5.5", + "args": { + "base_image": "bcgovimages/von-image:py36-1.15-0" + }, + }, + { + "version": "0.5.6", + "args": { + "base_image": "bcgovimages/von-image:py36-1.15-0" + }, + }, + { + "version": "0.6.0", + "args": { + "base_image": "bcgovimages/von-image:py36-1.15-1" + }, + }, + { + "version": "0.7.0", + "args": { + "base_image": "bcgovimages/von-image:py36-1.16-1", + "acapy_reqs": "" + }, + }, + { + "version": "0.7.1", + "args": { + "base_image": "bcgovimages/von-image:py36-1.16-1", + "acapy_reqs": "[askar,bbs]" + }, + }, + { + "version": "0.7.2-rc0", + "args": { + "base_image": "bcgovimages/von-image:py36-1.16-1", + "acapy_reqs": "[askar,bbs]" + }, } ] } @@ -130,7 +187,7 @@ def get_implementation_version(implementation: str, version: str) -> dict: DEFAULT_NAME = "bcgovimages/aries-cloudagent" -parser = argparse.ArgumentParser(description="Generate the aries-cloudagent Docker image") +parser = argparse.ArgumentParser(description="Generate an aries-cloudagent Docker image") parser.add_argument( "-n", "--name", default=DEFAULT_NAME, help="the base name for the docker image" ) @@ -151,13 +208,13 @@ def get_implementation_version(implementation: str, version: str) -> dict: help="output an updated Dockerfile with the build arguments replaced", ) parser.add_argument("--python", help="use a specific python version") -parser.add_argument("--push", action="store_true", help="push the resulting image") +parser.add_argument("--push", action="store_true", help="implies the --test option; push the resulting image to Docker Hub, defaulting to the bcgovimages organization") parser.add_argument( "-q", "--quiet", action="store_true", help="suppress output from docker build" ) parser.add_argument("--platform", help="build for a specific platform") -parser.add_argument("--squash", action="store_true", help="produce a smaller image") -parser.add_argument("--test", action="store_true", help="perform tests on docker image") +# parser.add_argument("--squash", action="store_true", help="produce a smaller image") +parser.add_argument("--test", action="store_true", help="build test image and perform tests defined in python/test/validate.sh on docker image") parser.add_argument( "version", choices=list_versions(), help="the release version" ) @@ -220,8 +277,8 @@ def get_implementation_version(implementation: str, version: str) -> dict: cmd_args.extend(["-f", dockerfile]) if args.no_cache: cmd_args.append("--no-cache") -if args.squash: - cmd_args.append("--squash") +# if args.squash: +# cmd_args.append("--squash") cmd_args.extend(["-t", tag]) if args.platform: cmd_args.extend(["--platform", args.platform]) diff --git a/python/Dockerfile b/python/Dockerfile index 4efc8fb..20db721 100644 --- a/python/Dockerfile +++ b/python/Dockerfile @@ -6,6 +6,7 @@ ARG agent_version ARG agent_implementation ARG tag_name=aries-cloudagent ARG tag_version= +ARG acapy_reqs ENV SUMMARY="aries-cloudagent image" \ DESCRIPTION="aries-cloudagent provides a base image for running Hyperledger Aries agents in Docker. \ @@ -20,6 +21,6 @@ LABEL summary="$SUMMARY" \ version="$tag_version" \ maintainer="" -RUN pip install --no-cache-dir aries-cloudagent==${agent_version} +RUN pip install --no-cache-dir aries-cloudagent${acapy_reqs}==${agent_version} ENTRYPOINT ["/bin/bash", "-c", "aca-py \"$@\"", "--"] diff --git a/python/Dockerfile.test b/python/Dockerfile.test index 4f18f3f..f21e793 100644 --- a/python/Dockerfile.test +++ b/python/Dockerfile.test @@ -1,4 +1,7 @@ ARG base_image FROM $base_image +# There must be a better way to make the test/validate.sh script executable... +USER root COPY test test +RUN chmod ug+x test/validate.sh ENTRYPOINT ["/bin/bash", "-c", "test/validate.sh"]