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

chore(deps): update dependency rocker-org/rocker-versioned2 to v4.4.2 - abandoned #229

Merged
merged 3 commits into from
Nov 26, 2024
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
18 changes: 9 additions & 9 deletions .github/workflows/main-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
image: r-minimal
context: r-minimal
base_image: base
r_version_1: 4.4.1
r_version_1: 4.4.2
r_version_2: 4.3.3
secrets: inherit
r-datascience:
Expand All @@ -71,7 +71,7 @@ jobs:
image: r-datascience
context: r-datascience
base_image: r-minimal
r_version_1: 4.4.1
r_version_1: 4.4.2
r_version_2: 4.3.3
secrets: inherit
jupyter-python:
Expand Down Expand Up @@ -177,7 +177,7 @@ jobs:
image: rstudio
context: rstudio
base_image: r-datascience
r_version_1: 4.4.1
r_version_1: 4.4.2
r_version_2: 4.3.3
secrets: inherit
sparkr:
Expand All @@ -187,7 +187,7 @@ jobs:
image: sparkr
context: spark
base_image: r-minimal
r_version_1: 4.4.1
r_version_1: 4.4.2
r_version_2: 4.3.3
spark_version: 3.5.3
build_gpu: false
Expand All @@ -199,7 +199,7 @@ jobs:
image: rstudio-sparkr
context: rstudio
base_image: sparkr
r_version_1: 4.4.1
r_version_1: 4.4.2
r_version_2: 4.3.3
spark_version: 3.5.3
build_gpu: false
Expand All @@ -211,7 +211,7 @@ jobs:
image: jupyter-r
context: jupyter
base_image: r-datascience
r_version_1: 4.4.1
r_version_1: 4.4.2
r_version_2: 4.3.3
build_gpu: false
secrets: inherit
Expand All @@ -222,7 +222,7 @@ jobs:
image: r-python-julia
context: r-python-julia
base_image: r-minimal
r_version_1: 4.4.1
r_version_1: 4.4.2
build_gpu: false
secrets: inherit
vscode-r-python-julia:
Expand All @@ -232,7 +232,7 @@ jobs:
image: vscode-r-python-julia
context: vscode
base_image: r-python-julia
r_version_1: 4.4.1
r_version_1: 4.4.2
build_gpu: false
secrets: inherit
vscode-r:
Expand All @@ -242,7 +242,7 @@ jobs:
image: vscode-r
context: vscode
base_image: r-datascience
r_version_1: 4.4.1
r_version_1: 4.4.2
r_version_2: 4.3.3
build_gpu: false
secrets: inherit
78 changes: 48 additions & 30 deletions dev/build-chain.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import argparse
import subprocess
import sys
import shutil


chains = {
"rstudio": ["base", "r-minimal", "r-datascience", "rstudio"],
"rstudio-sparkr": ["base", "r-minimal", "spark", "rstudio"],
Expand All @@ -24,42 +23,61 @@
"vscode-python-minimal": ["base", "python-minimal", "vscode"],
"r-python-julia": ["base", "r-minimal", "r-python-julia"],
"vscode-r-python-julia": ["base", "r-minimal", "r-python-julia", "vscode"],
"vscode-r": ["base", "r-minimal", "r-datascience", "vscode"]
"vscode-r": ["base", "r-minimal", "r-datascience", "vscode"],
}

chain_name = sys.argv[1]
chain = chains[chain_name]

# GPU build if third argument says so
GPU = len(sys.argv) >= 3 and sys.argv[2] == "gpu"
# CLI configuration
parser = argparse.ArgumentParser(description="Build a Docker image chain.")
parser.add_argument(
"--chain",
required=True,
choices=chains.keys(),
help="The name of the chain to build (e.g., 'rstudio', 'python-datascience').",
)
parser.add_argument(
"--gpu",
action="store_true",
help="Whether to build with GPU support."
)
parser.add_argument(
"--version",
help="Specify a version for R or Python."
)


# Specific R/Python version specified in fourth argument
version = sys.argv[3] if len(sys.argv) >= 4 else None
language_key = "PYTHON_VERSION" if "python-minimal" in chain else "R_VERSION"
if __name__ == "__main__":

for i, image in enumerate(chain):
# Parse build configuration from CLI args
args = parser.parse_args()
chain_name = args.chain
chain = chains[chain_name]
gpu = args.gpu
version = args.version
language_key = "PYTHON_VERSION" if "python-minimal" in chain else "R_VERSION"

if image == "base":
shutil.copytree("scripts", "base/scripts", dirs_exist_ok=True)
if GPU:
previous_image = "nvidia/cuda:12.4.1-cudnn-devel-ubuntu22.04"
# Build chain
for i, image in enumerate(chain):
if image == "base":
shutil.copytree("scripts", "base/scripts", dirs_exist_ok=True)
previous_image = "nvidia/cuda:12.4.1-cudnn-devel-ubuntu22.04" if gpu else "ubuntu:22.04"
else:
previous_image = "ubuntu:22.04"
else:
previous_image = chain[i-1]
previous_image = chain[i - 1]

device_suffix = "-gpu" if GPU else ""
device_suffix = "-gpu" if gpu else ""

if i < len(chain) - 1:
tag = image
else:
tag = f"inseefrlab/onyxia-{chain_name}:dev"
if i < len(chain) - 1:
tag = image
else:
tag = f"inseefrlab/onyxia-{chain_name}:dev"

cmd = ["docker", "build", "--progress=plain", image, "-t", tag,
"--build-arg", f"BASE_IMAGE={previous_image}",
"--build-arg", f"DEVICE_SUFFIX={device_suffix}"]
if version:
cmd.extend(["--build-arg", f"{language_key}={version}"])
cmd = [
"docker", "build", "--progress=plain", image, "-t", tag,
"--build-arg", f"BASE_IMAGE={previous_image}",
"--build-arg", f"DEVICE_SUFFIX={device_suffix}"
]
if version:
cmd.extend(["--build-arg", f"{language_key}={version}"])

print(" ".join(cmd))
subprocess.run(cmd)
print(" ".join(cmd))
subprocess.run(cmd)
2 changes: 1 addition & 1 deletion r-minimal/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ FROM $BASE_IMAGE
LABEL maintainer="InseeFrLab <[email protected]>"

# R Config
ARG R_VERSION="4.4.1"
ARG R_VERSION="4.4.2"
ENV R_VERSION=${R_VERSION}
ENV R_HOME="/usr/local/lib/R"
ENV DEFAULT_USER="${USERNAME}"
Expand Down