Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 6 additions & 1 deletion .github/workflows/images-ci-cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ jobs:
with:
config: ${{ matrix.model-project }}/env.yaml

- name: Read the python version from the model-project pyproject.toml file
id: python_version
run: echo "PYTHON_VERSION=$(grep requires-python ${{ matrix.model-project }}/pyproject.toml | sed -rn 's/.*[><=]+([0-9]\.[0-9]+)\"/\1/p')" >> "$GITHUB_OUTPUT"

- name: Build the Docker image
uses: docker/build-push-action@v6
with:
Expand All @@ -81,6 +85,7 @@ jobs:
UBUNTU_IMAGE_NAME=${{ steps.uc_env.outputs['ubuntu_base_image.name'] }}
UBUNTU_IMAGE_TAG=${{ steps.uc_env.outputs['ubuntu_base_image.tag'] }}
MODEL_PROJECT_PATH=${{ matrix.model-project }}
PYTHON_VERSION=${{ steps.python_version.outputs.PYTHON_VERSION }}
load: true
tags: "${{ steps.image.outputs.name }}:${{ steps.image.outputs.tag }}"
labels: ${{ steps.meta.outputs.labels }}
Expand All @@ -102,7 +107,7 @@ jobs:
build-args: |
UBUNTU_IMAGE_NAME=${{ steps.uc_env.outputs['ubuntu_base_image.name'] }}
UBUNTU_IMAGE_TAG=${{ steps.uc_env.outputs['ubuntu_base_image.tag'] }}
PYTHON_VERS=${{ steps.uc_env.outputs['python_version'] }}
PYTHON_VERSION=${{ steps.python_version.outputs.PYTHON_VERSION }}
MODEL_PROJECT_PATH=${{ matrix.model-project }}
push: ${{ github.event.repository.name == 'model-collection' }}
tags: "${{ steps.image.outputs.name }}:${{ steps.image.outputs.tag }}"
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@ The 4 following parameters are mandatory and must be passed to the Dockerfile, u
- MODEL_PROJECT_PATH: the path ``<domain>/<use-case>/<NN architecture>`` you are working on.
- UBUNTU_IMAGE_NAME: the base Ubuntu docker image name indicated in the ``env.yaml`` file.
- UBUNTU_IMAGE_TAG: the base Ubuntu docker image tag indicated in the ``env.yaml`` file.
- PYTHON_VERSION: the python version that should be used. Should be picked from the ``pyproject.toml`` file.

To build the Docker image from the repository root directory, for example:

Expand All @@ -381,6 +382,7 @@ docker build \
--build-arg MODEL_PROJECT_PATH=<domain>/<use-case>/<NN architecture> \
--build-arg UBUNTU_IMAGE_NAME=nvidia/cuda \
--build-arg UBUNTU_IMAGE_TAG=11.7.1-cudnn8-runtime-ubuntu20.04 \
--build-arg PYTHON_VERSION=$(grep requires-python <domain>/<use-case>/<NN architecture>/pyproject.toml | sed -rn 's/.*[><=]+([0-9]\.[0-9]+)\"/\1/p') \
--build-arg uid=$(id -u) \
--build-arg gid=$(id -g) \
--build-arg uname=$(id -un) \
Expand Down
20 changes: 16 additions & 4 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

# Possibility to point to your own docker registry
ARG DOCKER_REGISTRY=docker.io
ARG UBUNTU_IMAGE_NAME
ARG UBUNTU_IMAGE_TAG
ARG UBUNTU_IMAGE_NAME=nvidia/cuda
ARG UBUNTU_IMAGE_TAG=12.8.1-cudnn-runtime-ubuntu22.04

##############################################################
# Final image
Expand All @@ -14,11 +14,17 @@ ARG UBUNTU_IMAGE_TAG
FROM ${DOCKER_REGISTRY}/${UBUNTU_IMAGE_NAME}:${UBUNTU_IMAGE_TAG}

ARG MODEL_PROJECT_PATH
ARG PYTHON_VERSION

# install required packages
ENV DEBIAN_FRONTEND="noninteractive"
RUN apt-get update \
&& apt-get install -y \
python3-dev \
software-properties-common \
&& add-apt-repository ppa:deadsnakes/ppa \
&& apt-get update \
&& apt-get install -y \
python${PYTHON_VERSION} \
python3-pip \
build-essential \
libssl-dev \
Expand All @@ -27,6 +33,10 @@ RUN apt-get update \
git \
&& apt-get clean

# re-link python3 to the proper python version
RUN rm -rf /usr/bin/python3 \
&& ln -s /usr/bin/python${PYTHON_VERSION} /usr/bin/python3

# create user ai4sim
ARG uid=1000
ARG gid=1000
Expand All @@ -47,8 +57,10 @@ ENV PATH=${PATH}:${AI4SIM_HOME}/.local/bin

# Install all the python dependencies in the environment
WORKDIR ${AI4SIM_HOME}/${MODEL_PROJECT_PATH}
ENV UV_NO_CACHE=1
RUN python3 -m pip install nox$(grep 'nox.needs_version' ./noxfile.py | sed -rn 's/.*\"([><=]=.*)\"/\1/p') \
&& python3 -m pip install uv \
&& python3 -m nox -s dev_dependencies --no-venv -- purge
&& python3 -m pip cache purge \
&& python3 -m nox -s dev_dependencies --no-venv

CMD ["bash"]
2 changes: 1 addition & 1 deletion reactive-flows/cnf-combustion/gnns/env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
# and the build of the Docker image (images-ci-cd.yaml) to set the environment.
ubuntu_base_image:
name: nvidia/cuda
tag: 12.4.1-cudnn-runtime-ubuntu22.04
tag: 12.8.1-cudnn-runtime-ubuntu22.04
4 changes: 2 additions & 2 deletions reactive-flows/cnf-combustion/gnns/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[project]
name = "cnf-combustion-gnns"
version = "0.1.0"
requires-python = ">=3.10"
requires-python = ">=3.11"
dependencies = [
"h5py==3.12.1",
"jsonargparse[signatures]==4.35.0",
Expand All @@ -21,7 +21,7 @@ dependencies = [

# Nox will find here the python version that will be used
classifiers = [
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
]

[dependency-groups]
Expand Down
Loading
Loading