This repo uses Jinja2 to generate Dockerfiles for RAPIDS.
- Dependencies
- Project Structure
- Development
- Building the Docker Images
- CI
- Pre-Commit Hook
- Adding a new Repo to Devel Images
- Recommended VS Code Plugin
Make sure to have the following dependencies installed to compile the Dockerfiles.
├── settings.yaml
├── context/
├── generated-dockerfiles/
├── generate_dockerfiles.py
└── templates/
└── partials/
settings.yaml
- Contains some default values used by all of the Jinja2 templates. All values from this file are available in the Jinja2 templates.context/
- Contains any files that will be copied into the Docker images during the Docker build process.generated-dockerfiles/
- Contains the latest compiled Dockerfiles. This folder is populated automatically and it's contents should never be edited directly by developers.generate_dockerfiles.py
- Python script to compile Jinja templates.templates/
- Contains the Jinja2 templates for the different RAPIDS image types.partials/
- Contains Jinja2 templates that may be included from files in the parenttemplates
folder. Only create a partial if a piece of code needs to be repeated across multiple parent templates.
Dockerfile changes should be made to the templates/
folder.
Once changes have been made, run the following command to generate the Dockerfiles:
python generate_dockerfiles.py
# or
./generate_dockerfiles.py
This will write the Dockerfiles to the generated-dockerfiles
directory.
See the Building Images section in the README.md
for details on how to build the compiled Dockerfiles.
The following CI checks must pass before a PR can be merged:
- Dockerfiles updated - the Dockerfiles in
generated-dockerfiles
must be up to date. Make sure to have run and committed the files that are output fromgenerate_dockerfiles.py
to ensure this check passes. See the Pre-commit Hook section below to get earlier feedback.
This repo utilizes pre-commit to provide developers with quick feedback about their changes. Install pre-commit and run pre-commit install
from the project's root folder to activate the hooks.
To add a new repo to the devel
image, simply add another entry to the RAPIDS_LIBS
list in settings.yaml
. The attributes of RAPIDS_LIBS
are explained below:
RAPIDS_LIBS:
- name: xgboost # name of the library
repo_url: https://github.com/rapidsai/xgboost.git # URL of the repo
update_submodules: no # (optional, default: yes) determines whether the "--remote-submodules" flag should be used when cloning the repo
branch: rapids-0.14-release # (optional, default: "branch-<rapids_version>") branch to be cloned inside of the image
If the new repo does not have a build.sh
file in it's root directory and thus requires special instructions to build, make sure to add an additional elif
block to the build loop in Devel.dockerfile.j2.
Users using VS Code as their editor can install the Better Jinja plugin to enable Jinja syntax highlighting for *.dockerfile.j2
files.