Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Latest von-image #1

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 30 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -43,22 +44,46 @@ 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

## Pre-requisites

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

Expand Down
69 changes: 63 additions & 6 deletions make_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]"
},
}
]
}
Expand Down Expand Up @@ -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"
)
Expand All @@ -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"
)
Expand Down Expand Up @@ -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])
Expand Down
3 changes: 2 additions & 1 deletion python/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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. \
Expand All @@ -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 \"$@\"", "--"]
3 changes: 3 additions & 0 deletions python/Dockerfile.test
Original file line number Diff line number Diff line change
@@ -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"]