Add organized Docker container structure with disciplined naming

- Create layered container architecture: Base, Light, Full, Computational
- Implement non-root user management with UID/GID mapping
- Add Markwhen timeline tool to documentation stack
- Create wrapper scripts for environment variable handling
- Update documentation across all containers
- Establish naming convention using RCEO-AIOS-Public-Tools- prefix
- Add organizational rule to keep repository root clean
- Remove old unorganized container files
This commit is contained in:
2025-10-16 11:40:25 -05:00
parent 7fad76ea9d
commit d30f103209
24 changed files with 1055 additions and 131 deletions

View File

@@ -0,0 +1,42 @@
FROM rceo-aios-public-tools-docmaker-full:latest
# Avoid prompts from apt
ENV DEBIAN_FRONTEND=noninteractive
# Install computational tools
RUN apt-get update && apt-get install -y \
r-base \
r-base-dev \
bc \
octave \
&& rm -rf /var/lib/apt/lists/*
# Install Python scientific packages
RUN pip3 install pandas numpy matplotlib scipy jupyter
# Install R packages (commonly used ones)
RUN R -e "install.packages(c('knitr', 'rmarkdown', 'dplyr', 'ggplot2'), repos='https://cran.rstudio.com/')"
# Install IRkernel for R in Jupyter
RUN R -e "install.packages('IRkernel', repos='https://cran.rstudio.com/')"
# Create Jupyter config directory and set up notebook directory
RUN mkdir -p /workspace/notebooks
# Create Jupyter startup script
RUN echo '#!/bin/bash' > /jupyter_start.sh && \
echo '# Install R kernel for Jupyter if R is available' >> /jupyter_start.sh && \
echo 'if command -v R &> /dev/null; then' >> /jupyter_start.sh && \
echo ' R -e "IRkernel::installspec()" 2>/dev/null || true' >> /jupyter_start.sh && \
echo 'fi' >> /jupyter_start.sh && \
echo '# Run Jupyter as the proper user' >> /jupyter_start.sh && \
echo 'exec su -p ReachableCEO-Tools -c "jupyter notebook --ip=0.0.0.0 --port=8888 --no-browser --allow-root --notebook-dir=/workspace/notebooks"' >> /jupyter_start.sh && \
chmod +x /jupyter_start.sh
# Expose Jupyter on port 8888
EXPOSE 8888
# Create a working directory
WORKDIR /workspace
# The entrypoint from the base image handles user creation

View File

@@ -0,0 +1,97 @@
# RCEO-AIOS-Public-Tools-DocMaker-Computational Container
This container is part of the AIOS-Public project and provides a comprehensive documentation and computational environment.
## Overview
The RCEO-AIOS-Public-Tools-DocMaker-Computational container extends the full documentation environment with computational tools for data analysis, scientific computing, and interactive notebooks. It's designed for CTO mode operations involving R&D and computational work.
## Tools Included
Inherits all tools from:
- **RCEO-AIOS-Public-Tools-DocMaker-Full**: All documentation and LaTeX tools
### Computational Tools
- **R Programming Language**: Statistical computing and data analysis
- **Python Scientific Stack**:
- pandas - Data manipulation
- numpy - Numerical computing
- matplotlib - Visualization
- scipy - Scientific computing
- **Jupyter Notebooks**: Interactive computational environments
- **GNU Octave**: Numerical computations (MATLAB alternative)
- **bc**: Command-line calculator
## Usage
### Building the Computational Container
```bash
# From this directory
cd /home/localuser/AIWorkspace/AIOS-Public/Docker/RCEO-AIOS-Public-Tools-DocMaker-Computational
# Use the wrapper script to automatically detect and set user IDs
./docker-compose-wrapper.sh build
# Or run commands in the computational container with automatic user mapping
./docker-compose-wrapper.sh run docmaker-computational [command]
# Example: Run R analysis
./docker-compose-wrapper.sh run docmaker-computational Rscript analysis.R
# Example: Run Python analysis
./docker-compose-wrapper.sh run docmaker-computational python analysis.py
# Example: Start Jupyter notebook server
./docker-compose-wrapper.sh up
# Then access at http://localhost:8888
```
### Using with docker-compose directly
```bash
# Set environment variables and run docker-compose directly
LOCAL_USER_ID=$(id -u) LOCAL_GROUP_ID=$(id -g) docker-compose up --build
# Or export variables first
export LOCAL_USER_ID=$(id -u)
export LOCAL_GROUP_ID=$(id -g)
docker-compose up
```
### Using the wrapper script
```bash
# Build and start the computational container with Jupyter access and automatic user mapping
./docker-compose-wrapper.sh up --build
# Start without rebuilding
./docker-compose-wrapper.sh up
# View container status
./docker-compose-wrapper.sh ps
# Stop containers
./docker-compose-wrapper.sh down
```
## User ID Mapping (For File Permissions)
The container automatically detects and uses the host user's UID and GID to ensure proper file permissions. This means:
- Files created inside the container will have the correct ownership on the host
- No more root-owned files after container operations
- Works across different environments (development, CI/CD, cloud)
The container detects the user ID from the mounted workspace volume. If needed, you can override the default values by setting environment variables:
```bash
# Set specific user ID and group ID before running docker-compose
export LOCAL_USER_ID=1000
export LOCAL_GROUP_ID=1000
docker-compose up
```
Or run with inline environment variables:
```bash
LOCAL_USER_ID=1000 LOCAL_GROUP_ID=1000 docker-compose up
```
The container runs as a non-root user named `ReachableCEO-Tools` with the detected host user's UID/GID.

View File

@@ -0,0 +1,67 @@
#!/bin/bash
# docker-compose-wrapper.sh - Wrapper script to detect host UID/GID and run docker-compose
set -e # Exit on any error
# Detect the UID and GID of the user that owns the workspace directory (parent directory)
WORKSPACE_DIR="$(cd "$(dirname "$0")/../.." && pwd)"
echo "Detecting user ID from workspace directory: $WORKSPACE_DIR"
if [ -d "$WORKSPACE_DIR" ]; then
DETECTED_USER_ID=$(stat -c %u "$WORKSPACE_DIR" 2>/dev/null || echo 0)
DETECTED_GROUP_ID=$(stat -c %g "$WORKSPACE_DIR" 2>/dev/null || echo 0)
# If detection failed, try current user
if [ "$DETECTED_USER_ID" = "0" ]; then
DETECTED_USER_ID=$(id -u)
DETECTED_GROUP_ID=$(id -g)
fi
else
# Fallback to current user if workspace directory doesn't exist
DETECTED_USER_ID=$(id -u)
DETECTED_GROUP_ID=$(id -g)
fi
echo "Detected USER_ID=$DETECTED_USER_ID and GROUP_ID=$DETECTED_GROUP_ID"
# Set environment variables for docker-compose
export LOCAL_USER_ID=$DETECTED_USER_ID
export LOCAL_GROUP_ID=$DETECTED_GROUP_ID
# Show usage information
echo ""
echo "Usage: $0 [build|up|run <service> <command>|exec <service> <command>|down|ps]"
echo ""
echo "Examples:"
echo " $0 up # Start services"
echo " $0 build # Build containers"
echo " $0 run docmaker-full bash # Run command in container"
echo " $0 down # Stop and remove containers"
echo ""
# Check if docker compose (new format) or docker-compose (old format) is available
if command -v docker &> /dev/null && docker compose version &> /dev/null; then
# Use new docker compose format
if [ $# -eq 0 ]; then
echo "No command provided. Running 'docker compose up'..."
docker compose up
else
# Execute the provided docker compose command
echo "Running: docker compose $*"
docker compose "$@"
fi
elif command -v docker-compose &> /dev/null; then
# Fallback to old docker-compose format
if [ $# -eq 0 ]; then
echo "No command provided. Running 'docker-compose up'..."
docker-compose up
else
# Execute the provided docker-compose command
echo "Running: docker-compose $*"
docker-compose "$@"
fi
else
echo "Error: Neither 'docker compose' nor 'docker-compose' command found."
echo "Please install Docker Compose to use this script."
exit 1
fi

View File

@@ -0,0 +1,20 @@
version: '3.8'
services:
docmaker-computational:
build:
context: .
dockerfile: Dockerfile
container_name: RCEO-AIOS-Public-Tools-DocMaker-Computational
image: rceo-aios-public-tools-docmaker-computational:latest
volumes:
- ../../../:/workspace:rw
working_dir: /workspace
stdin_open: true
tty: true
ports:
- "8888:8888" # Jupyter notebook access
environment:
- LOCAL_USER_ID=${LOCAL_USER_ID:-1000}
- LOCAL_GROUP_ID=${LOCAL_GROUP_ID:-1000}
user: "${LOCAL_USER_ID:-1000}:${LOCAL_GROUP_ID:-1000}"