How ARG_PROFILE Build Arguments Work in LabNow AI Docker Images
ARG_PROFILE build arguments are conditional Docker build-time flags that enable specific language runtimes and toolchains when set to "true", allowing users to compose lightweight, purpose-specific images in the labnow-ai/lab-foundation repository.
The labnow-ai/lab-foundation repository implements a modular build system centered on ARG_PROFILE_* arguments to customize Docker images at compile time. These boolean-style flags declared in docker_core/Dockerfile control whether optional components like Python, R, or Java are included in the final image. By toggling these arguments during docker build, you create tailored environments without bloating the base image.
Core Profile Arguments in docker_core/Dockerfile
The primary definitions reside in docker_core/Dockerfile (lines 9–25), which declares nine optional profile arguments. Each argument defaults to false when omitted, ensuring the image remains minimal unless explicitly configured.
- ARG_PROFILE_NODEJS: Installs Node.js runtime and npm packages
- ARG_PROFILE_R: Adds the R language and CRAN packages
- ARG_PROFILE_PYTHON: Includes Python and pip packages, respecting the
PYTHON_VERSIONenvironment variable (default"3.12") - ARG_PROFILE_GO: Adds the Go toolchain
- ARG_PROFILE_JULIA: Installs the Julia language
- ARG_PROFILE_RUST: Adds the Rust compiler and cargo
- ARG_PROFILE_OCTAVE: Installs GNU Octave for numerical computing
- ARG_PROFILE_LATEX: Provides a full LaTeX distribution for PDF generation
- ARG_PROFILE_JAVA: Adds OpenJDK with version controlled by
VERSION_JDK(default17)
When you pass any of these arguments as "true" during the build process, the Dockerfile executes the corresponding conditional RUN block to install that toolchain via the system's package manager (apt, conda, or pip).
Build Command Syntax
Pass these arguments using the --build-arg flag during image compilation. The following examples demonstrate common usage patterns.
Build a Python-enabled image with version 3.12:
docker build \
--build-arg ARG_PROFILE_PYTHON=true \
--build-arg PYTHON_VERSION=3.12 \
-t labnow/python:latest .
Build a multi-language data science stack with R, Julia, and Go:
docker build \
--build-arg ARG_PROFILE_PYTHON=true \
--build-arg ARG_PROFILE_R=true \
--build-arg ARG_PROFILE_JULIA=true \
--build-arg ARG_PROFILE_GO=true \
-t labnow/ds-stack:latest .
Build a Java-specific image with JDK 21:
docker build \
--build-arg ARG_PROFILE_JAVA=true \
--build-arg VERSION_JDK=21 \
-t labnow/java:21 .
Conditional Installation Logic
Inside docker_core/Dockerfile, each ARG_PROFILE_* argument controls a conditional RUN instruction. When an argument evaluates to "true", the Dockerfile executes the corresponding installation block. For example, setting ARG_PROFILE_PYTHON=true triggers the Python installation routine, which also respects the PYTHON_VERSION variable to select between Python releases. Similarly, ARG_PROFILE_JAVA=true activates the OpenJDK installation path governed by VERSION_JDK.
Repository Structure and Supporting Files
The modular build system spans multiple Dockerfiles across the repository:
- docker_core/Dockerfile: Declares all
ARG_PROFILE_arguments and conditional installation logic - docker_base/Dockerfile: Sets common base arguments (
BASE_NAMESPACE,BASE_IMG) inherited by profile builds - docker_atom/Dockerfile: Provides the minimal "atom" base image that profile-specific layers extend
- docker_cuda/nvidia-cuda.Dockerfile: Demonstrates GPU-enabled builds that respect the same profile arguments
Benefits of Modular Profile Builds
Using ARG_PROFILE build arguments delivers three primary advantages for container workflows:
- Reduced Build Time: Compiling only required runtimes skips unnecessary package downloads and installations, shortening the build cycle
- Smaller Image Size: Omitting unused toolchains significantly decreases the final image footprint by excluding unneeded language runtimes and libraries
- Workload Flexibility: Tailor images for specific domains, such as NLP pipelines (Python + PyTorch), statistical analysis (R), or scientific computing (Julia) without maintaining separate Dockerfile variants
Summary
- ARG_PROFILE_* arguments are defined in
docker_core/Dockerfile(lines 9–25) and default tofalse - Setting any profile argument to
"true"duringdocker buildactivates conditional installation blocks for that toolchain - Java profiles use
VERSION_JDK(default17) while Python profiles respectPYTHON_VERSION(default"3.12") - The system supports Node.js, R, Python, Go, Julia, Rust, Octave, LaTeX, and Java via modular toggles
- Supporting files in
docker_base/,docker_atom/, anddocker_cuda/maintain consistent argument handling across image variants
Frequently Asked Questions
What is the default value for ARG_PROFILE arguments in LabNow AI?
All ARG_PROFILE_* arguments default to false if not specified during the build. This design ensures that the base image remains lightweight and contains only essential components unless explicitly configured to include additional runtimes.
How do I install a specific Python version using ARG_PROFILE?
Set ARG_PROFILE_PYTHON=true and specify the version via PYTHON_VERSION. For example, docker build --build-arg ARG_PROFILE_PYTHON=true --build-arg PYTHON_VERSION=3.11 installs Python 3.11 instead of the default 3.12 defined in the Dockerfile.
Can I combine multiple ARG_PROFILE arguments in a single build?
Yes. You can chain multiple --build-arg flags to include several toolchains simultaneously. For instance, combining ARG_PROFILE_R=true and ARG_PROFILE_PYTHON=true creates an image with both R and Python environments ready for polyglot data science workflows.
Where are the ARG_PROFILE arguments defined in the source code?
The declarations appear in docker_core/Dockerfile at lines 9–25 according to the labnow-ai/lab-foundation source code, with supporting configuration logic in docker_base/Dockerfile and the minimal base specification in docker_atom/Dockerfile.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →