Awesome
Atomic Reactor
Python library with command line interface for building docker images.
Features
- Push image to registry when it's built
- Build inside a docker container (so your builds are separated between each other)
- git as a source to your Dockerfile (you may specify commit/branch and path to Dockerfile within the git repo)
- Collect build logs
- Integration with koji build system
- Integration with fedora packaging system
- Inject arbitrary yum repo inside Dockerfile (change source of your packages)
- Retag base image so it matches
FROM
instruction in Dockerfile - Change base image (
FROM
) in your Dockerfile - Run simple tests after your image is built
Installation
From git
Clone this git repo and install Atomic Reactor using python installer:
git clone https://github.com/containerbuildsystem/atomic-reactor.git
cd atomic-reactor
pip install . --user
You don't even need to install it. You may use it straight from git:
export PYTHONPATH="${REACTOR_PATH}:${PYTHONPATH}"
alias atomic-reactor="python ${REACTOR_PATH}/atomic-reactor/cli/main.py"
Adding Dependencies
To add more Python dependencies, add them to the following files:
- setup.py
- requirements.in
- tests/requirements.in for test dependencies
- requirements-devel.in for dependencies that are required during development
If you're wondering why you need to add dependencies to both files (setup.py and one of the requirements files), see install_requires vs requirements files.
To be able to build atomic-reactor with Cachito, we also need to keep the build requirements updated. Please follow Cachito pip build dependencies for updating build requirements. Please note that the resulting requirements will need to be pinned to older versions before moving to the next step to avoid installation issues with newer dependency versions.
Afterwards, pip-compile the dependencies via make pip-compile
(you may need to
run make venv
first, unless the venv already exists).
Additionally, if any of the newly added dependencies in the generated
requirements*.txt
files need to be compiled from C code, please install any
missing C libraries in the Dockerfile(s) as well as the test.sh script
Running tests
The prerequisite of running tests is to create a test environment container by
test.sh
. For example:
OS=fedora OS_VERSION=35 PYTHON_VERSION=3 ACTION=test ./test.sh
When the container is ready and running, you have choice to test your changes
by executing pytest
directly:
podman exec -it atomic-reactor-fedora-35-py3 python3 -m pytest tests/
or by tox
:
podman exec -it atomic-reactor-fedora-35-py3 tox -e test
The tox.ini
has defined several testenvs, use tox -l
to check them.
Usage
If you would like to build your images within build containers, you need to obtain images for those containers. We call them build images. Atomic Reactor is installed inside and used to take care of build itself.
You can either get the build image from Dockerhub or create it yourself.