### Example Output of Setup Script Source: https://github.com/openai/codex-universal/blob/main/_autodocs/scripts-api.md This shows the typical output when the setup script runs, indicating the progress of language runtime configuration. ```text Configuring language runtimes... # Python: 3.12 Python 3.12.0 # Node.js: v20 (default: v22) ``` -------------------------------- ### Direct Execution Example Source: https://github.com/openai/codex-universal/blob/main/_autodocs/scripts-api.md Demonstrates how to run the setup script directly within a Docker container. ```bash docker run --rm -it ghcr.io/openai/codex-universal:latest /opt/codex/setup_universal.sh ``` -------------------------------- ### Node.js: Install Dependencies and Run Source: https://github.com/openai/codex-universal/blob/main/_autodocs/usage-guide.md Sets up a Node.js 20 environment, installs npm dependencies, builds the project, and starts the application. Assumes package.json is present. ```bash docker run --rm -it \ -e CODEX_ENV_NODE_VERSION=20 \ -v $(pwd):/workspace \ -w /workspace \ ghcr.io/openai/codex-universal:latest # Inside container: root@a1b2c3d4e5f6:/workspace# npm install root@a1b2c3d4e5f6:/workspace# npm run build root@a1b2c3d4e5f6:/workspace# npm start ``` -------------------------------- ### Install Swift using Swiftly Source: https://github.com/openai/codex-universal/blob/main/_autodocs/language-toolchains.md Installs the 'swiftly' version manager by downloading and extracting a tarball, then initializes it and installs a specific Swift version. This is typically used within a Dockerfile for environment setup. ```bash curl -O https://download.swift.org/swiftly-$(uname -m).tar.gz tar zxf swiftly-$(uname -m).tar.gz ./swiftly init --quiet-shell-followup swiftly install "6.2" ``` -------------------------------- ### Install and Run with yarn Source: https://github.com/openai/codex-universal/blob/main/_autodocs/language-toolchains.md Use yarn to add packages and start your application. Yarn is managed via Corepack. ```bash yarn add react yarn start ``` -------------------------------- ### Full-Stack Development Setup (Python Backend, Node.js Frontend) Source: https://github.com/openai/codex-universal/blob/main/_autodocs/usage-guide.md Use this snippet to set up and run a full-stack application. It involves installing frontend dependencies, building the frontend, and setting up/running the Python backend within the container. ```bash docker run --rm -it \ -e CODEX_ENV_PYTHON_VERSION=3.12 \ -e CODEX_ENV_NODE_VERSION=20 \ -v $(pwd):/workspace \ -w /workspace \ ghcr.io/openai/codex-universal:latest # Inside container: # Setup frontend root@a1b2c3d4e5f6:/workspace# cd frontend root@a1b2c3d4e5f6:/workspace/frontend# npm install root@a1b2c3d4e5f6:/workspace/frontend# npm run build # Setup backend root@a1b2c3d4e5f6:/workspace# cd ../backend root@a1b2c3d4e5f6:/workspace/backend# python3 -m venv venv root@a1b2c3d4e5f6:/workspace/backend# source venv/bin/activate root@a1b2c3d4e5f6:/workspace/backend# pip install -r requirements.txt root@a1b2c3d4e5f6:/workspace/backend# python3 api/main.py ``` -------------------------------- ### Create and Run a Bun Project with Hono Source: https://github.com/openai/codex-universal/blob/main/_autodocs/language-toolchains.md Scaffolds a new project using the Hono web framework with Bun, installs dependencies, and starts the development server. ```bash bun create hono my-app cd my-app bun install bun dev ``` -------------------------------- ### Install Composer Source: https://github.com/openai/codex-universal/blob/main/_autodocs/language-toolchains.md Downloads the Composer installer, executes it to install Composer, and moves the binary to a global path. ```bash curl -sS https://getcomposer.org/installer | php mv composer.phar /usr/local/bin/composer ``` -------------------------------- ### Install Rust using rustup (Minimal Profile) Source: https://github.com/openai/codex-universal/blob/main/_autodocs/language-toolchains.md Installs Rust using rustup with a minimal profile, which excludes documentation. Components like rustfmt and clippy can be installed separately. ```bash curl -sSf https://sh.rustup.rs | sh -s -- \ -y --profile minimal --default-toolchain none ``` -------------------------------- ### Python: Install Dependencies and Run Source: https://github.com/openai/codex-universal/blob/main/_autodocs/usage-guide.md Sets up a Python 3.12 environment, installs dependencies from requirements.txt, and runs the main Python script. Ensure requirements.txt is in your current directory. ```bash docker run --rm -it \ -e CODEX_ENV_PYTHON_VERSION=3.12 \ -v $(pwd):/workspace \ -w /workspace \ ghcr.io/openai/codex-universal:latest # Inside container: root@a1b2c3d4e5f6:/workspace# python3 -m venv venv root@a1b2c3d4e5f6:/workspace# source venv/bin/activate root@a1b2c3d4e5f6:/workspace# pip install -r requirements.txt root@a1b2c3d4e5f6:/workspace# python3 main.py ``` -------------------------------- ### Install and Set Global Go Version with Mise Source: https://github.com/openai/codex-universal/blob/main/_autodocs/language-toolchains.md Installs multiple Go versions using 'mise' and sets the first specified version as the global default. This is typically used within a Dockerfile for environment setup. ```dockerfile for v in $GO_VERSIONS; do mise install "go@${v}"; done mise use --global "go@${GO_VERSIONS%% *}" # First version ``` -------------------------------- ### Run JavaScript File with Bun Source: https://github.com/openai/codex-universal/blob/main/_autodocs/language-toolchains.md Executes a JavaScript file using the Bun runtime. This is a basic example to verify Bun installation and execution. ```bash echo 'console.log("Hello from Bun!")' > app.js bun app.js ``` -------------------------------- ### Install Packages with uv Source: https://github.com/openai/codex-universal/blob/main/_autodocs/language-toolchains.md Use `uv pip install` for a faster alternative to `pip` for installing Python packages. Ensure uv is installed and accessible. ```bash uv pip install requests # Much faster than pip ``` -------------------------------- ### Copy and Make Setup Script Executable Source: https://github.com/openai/codex-universal/blob/main/_autodocs/dockerfile-reference.md Copies the setup script into the image and makes it executable. This script is intended for runtime configuration. ```dockerfile COPY setup_universal.sh /opt/codex/setup_universal.sh RUN chmod +x /opt/codex/setup_universal.sh ``` -------------------------------- ### Docker Compose Usage Commands Source: https://github.com/openai/codex-universal/blob/main/_autodocs/usage-guide.md Commands to start the development container, install dependencies, start the application, or run a specific script within the container. ```bash # Start development container docker-compose run --rm dev # Inside container: root@a1b2c3d4e5f6:/workspace# npm install root@a1b2c3d4e5f6:/workspace# npm start # Or run specific command docker-compose run --rm dev python3 script.py ``` -------------------------------- ### Install Bazelisk and Link Bazel Source: https://github.com/openai/codex-universal/blob/main/_autodocs/language-toolchains.md Download Bazelisk, make it executable, and create a symlink for 'bazel'. ```bash curl -L https://github.com/bazelbuild/bazelisk/releases/download/v1.26.0/bazelisk-linux-amd64 chmod +x bazelisk ln -s bazelisk bazel ``` -------------------------------- ### Install and Run with npm Source: https://github.com/openai/codex-universal/blob/main/_autodocs/language-toolchains.md Use npm to install project dependencies and run scripts. Ensure npm is available in your Node.js environment. ```bash npm install express npm run start ``` -------------------------------- ### Dockerfile Example for Verification Source: https://github.com/openai/codex-universal/blob/main/_autodocs/scripts-api.md Demonstrates how to run the verify.sh script during a Docker image build. ```dockerfile RUN PYTHON_VERSIONS="$PYTHON_VERSIONS" \ NODE_VERSIONS="24 22 20 18" \ /opt/verify.sh ``` -------------------------------- ### Install C++ Analysis Tools via Pipx Source: https://github.com/openai/codex-universal/blob/main/_autodocs/language-toolchains.md Install C++ linting and formatting tools using pipx. ```dockerfile pipx install cpplint clang-tidy clang-format cmakelang ``` -------------------------------- ### Install Python from Source Source: https://github.com/openai/codex-universal/blob/main/_autodocs/language-toolchains.md Compile and install a specific Python version from source using pyenv. This process can take a significant amount of time. ```bash pyenv install 3.12 # Compiles from source ``` -------------------------------- ### Install Bun with Mise Source: https://github.com/openai/codex-universal/blob/main/_autodocs/dockerfile-reference.md Installs a specific version of the Bun JavaScript runtime using the 'mise' tool. ```dockerfile mise use --global "bun@${BUN_VERSION}" ``` -------------------------------- ### Go: Create Module, Get Dependencies, and Build Source: https://github.com/openai/codex-universal/blob/main/_autodocs/usage-guide.md Initializes a Go module, fetches a specific dependency (Gorilla Mux), and builds the Go project. Assumes Go 1.23.8 environment. ```bash docker run --rm -it \ -e CODEX_ENV_GO_VERSION=1.23.8 \ -v $(pwd):/workspace \ -w /workspace \ ghcr.io/openai/codex-universal:latest # Inside container: root@a1b2c3d4e5f6:/workspace# mkdir myapp && cd myapp root@a1b2c3d4e5f6:/workspace/myapp# go mod init github.com/user/myapp root@a1b2c3d4e5f6:/workspace/myapp# go get github.com/gorilla/mux root@a1b2c3d4e5f6:/workspace/myapp# go build root@a1b2c3d4e5f6:/workspace/myapp# ./myapp ``` -------------------------------- ### Install Java Versions using Mise Source: https://github.com/openai/codex-universal/blob/main/_autodocs/language-toolchains.md Iterates through a list of Java versions and installs each one using the 'mise' version manager. ```dockerfile for v in $JAVA_VERSIONS; do mise install "java@${v}"; done ``` -------------------------------- ### List Installed Rust Versions Source: https://github.com/openai/codex-universal/blob/main/_autodocs/language-toolchains.md Lists all installed Rust toolchain versions managed by rustup. ```bash rustup toolchain list ``` -------------------------------- ### Port Forwarding with Docker Source: https://github.com/openai/codex-universal/blob/main/_autodocs/usage-guide.md Run the Codex Universal image, forward port 3000, and mount the current directory. Inside the container, install dependencies and start the application. Access the service on the host machine. ```bash docker run --rm -it \ -e CODEX_ENV_NODE_VERSION=20 \ -p 3000:3000 \ -v $(pwd):/workspace \ -w /workspace \ ghcr.io/openai/codex-universal:latest # Inside container: root@a1b2c3d4e5f6:/workspace# npm install express root@a1b2c3d4e5f6:/workspace# npm start # On host: curl http://localhost:3000 ``` -------------------------------- ### List Installed Node Versions Source: https://github.com/openai/codex-universal/blob/main/_autodocs/language-toolchains.md Use the `nvm list` command to display all Node.js versions currently installed on the system. ```bash nvm list ``` -------------------------------- ### Read Project Documentation Source: https://github.com/openai/codex-universal/blob/main/_autodocs/README.md Use 'cat' to read specific documentation files. Start with index.md and then select other files based on your needs. ```bash # Start with the index cat index.md # Then pick what you need: # For configuration: cat configuration.md # For languages: cat language-toolchains.md # For examples: cat usage-guide.md # For scripts: cat scripts-api.md # For Dockerfile: cat dockerfile-reference.md ``` -------------------------------- ### Install PHP Version with phpenv Source: https://github.com/openai/codex-universal/blob/main/_autodocs/language-toolchains.md Installs a specific PHP version from source using phpenv, noting the required 'snapshot' suffix for versions. ```bash phpenv install -s "8.4snapshot" # Builds from source ``` -------------------------------- ### Install Rust Toolchain Components Source: https://github.com/openai/codex-universal/blob/main/_autodocs/language-toolchains.md Installs a specific Rust toolchain version with the minimal profile and includes the rustfmt and clippy components. ```dockerfile rustup toolchain install $VERSION \ --profile minimal \ --component rustfmt --component clippy ``` -------------------------------- ### List Installed Java Versions with Mise Source: https://github.com/openai/codex-universal/blob/main/_autodocs/language-toolchains.md Displays all Java versions currently managed and installed by the 'mise' version manager. ```bash mise list java ``` -------------------------------- ### Programmatic Execution within Container Source: https://github.com/openai/codex-universal/blob/main/_autodocs/scripts-api.md Illustrates how to set an environment variable and execute the setup script from within a running container, followed by a command to verify a language version. ```bash #!/bin/bash export CODEX_ENV_RUST_VERSION=1.87.0 /opt/codex/setup_universal.sh cargo --version ``` -------------------------------- ### Start PHP Built-in Web Server Source: https://github.com/openai/codex-universal/blob/main/_autodocs/language-toolchains.md Launches PHP's built-in web server on localhost, listening on port 8000. ```bash php -S localhost:8000 ``` -------------------------------- ### Install Composer PHP Dependency Manager Source: https://github.com/openai/codex-universal/blob/main/_autodocs/dockerfile-reference.md Downloads and installs the Composer PHP dependency manager globally to /usr/local/bin/composer. ```dockerfile curl -sS https://getcomposer.org/installer | php mv composer.phar /usr/local/bin/composer ``` -------------------------------- ### Install Ruby Versions with Mise Source: https://github.com/openai/codex-universal/blob/main/_autodocs/dockerfile-reference.md Installs multiple Ruby versions using 'mise' and sets the global default to the first version specified. ```dockerfile for v in $RUBY_VERSIONS; do mise install "ruby@${v}"; done mise use --global "ruby@${RUBY_VERSIONS%% *}" # First version ``` -------------------------------- ### Install Erlang and Elixir via Mise Source: https://github.com/openai/codex-universal/blob/main/_autodocs/language-toolchains.md Install specific versions of Erlang and Elixir using the mise version manager. ```dockerfile mise install "erlang@27.1.2" "elixir@1.18.3-otp-27" ``` -------------------------------- ### Create and Manage Composer Projects Source: https://github.com/openai/codex-universal/blob/main/_autodocs/language-toolchains.md Creates a new Laravel project, navigates into it, and installs its Composer dependencies. ```bash composer create-project laravel/laravel my-app cd my-app composer install ``` -------------------------------- ### Go Verification Command Source: https://github.com/openai/codex-universal/blob/main/_autodocs/scripts-api.md Verifies the Go toolchain installation. ```bash go version ``` -------------------------------- ### Start Erlang Shell Source: https://github.com/openai/codex-universal/blob/main/_autodocs/language-toolchains.md Launch the Erlang interactive shell. ```bash erl ``` -------------------------------- ### List Installed Go Versions with Mise Source: https://github.com/openai/codex-universal/blob/main/_autodocs/language-toolchains.md Lists all Go versions currently managed by the 'mise' version manager. ```bash mise list go ``` -------------------------------- ### Start Bun REPL Source: https://github.com/openai/codex-universal/blob/main/_autodocs/language-toolchains.md Launches the Bun Read-Eval-Print Loop (REPL) for interactive JavaScript execution. ```bash bun # Interactive prompt ``` -------------------------------- ### Node.js Verification Commands Source: https://github.com/openai/codex-universal/blob/main/_autodocs/scripts-api.md Verifies Node.js, npm, pnpm, and yarn installations, and lists globally installed npm packages. ```bash node --version npm --version pnpm --version yarn --version npm ls -g ``` -------------------------------- ### Entrypoint Script Source Code Source: https://github.com/openai/codex-universal/blob/main/_autodocs/scripts-api.md The source code for the entrypoint.sh script. This script initializes the environment, displays a welcome message, and executes the setup script before dropping into a bash shell. ```bash #!/bin/bash echo "==================================" echo "Welcome to openai/codex-universal!" echo "==================================" /opt/codex/setup_universal.sh echo "Environment ready. Dropping you into a bash shell." exec bash --login "$@" ``` -------------------------------- ### Check Installed Software Versions in Container Source: https://github.com/openai/codex-universal/blob/main/_autodocs/usage-guide.md Run this command to check the installed versions of Python, Node.js, Rust, Go, and Java within the container. ```bash docker run --rm ghcr.io/openai/codex-universal:latest \ bash -c \ "echo '=== Python ==='; python3 --version; pyenv versions echo '=== Node.js ==='; node --version; npm --version echo '=== Rust ==='; rustc --version; cargo --version echo '=== Go ==='; go version echo '=== Java ==='; java -version " ``` -------------------------------- ### Manage Ruby Gems with Bundler Source: https://github.com/openai/codex-universal/blob/main/_autodocs/language-toolchains.md Initializes a new Gemfile, adds a gem (Rails), and installs all project dependencies. ```bash bundle init bundle add rails bundle install ``` -------------------------------- ### Install Ruby Versions with Mise Source: https://github.com/openai/codex-universal/blob/main/_autodocs/language-toolchains.md Installs multiple specified Ruby versions using the mise version manager within a Dockerfile context. ```dockerfile for v in $RUBY_VERSIONS; do mise install "ruby@${v}"; done ``` -------------------------------- ### Start Interactive Elixir Shell Source: https://github.com/openai/codex-universal/blob/main/_autodocs/language-toolchains.md Launch the interactive Elixir shell (iex) for experimenting with Elixir code. ```bash iex ``` -------------------------------- ### Bun Verification Command Source: https://github.com/openai/codex-universal/blob/main/_autodocs/scripts-api.md Verifies the Bun runtime installation. ```bash bun --version ``` -------------------------------- ### Run Swift REPL Source: https://github.com/openai/codex-universal/blob/main/_autodocs/language-toolchains.md Starts the Swift interactive read-eval-print loop (REPL) for experimenting with Swift code. ```bash swift # Interactive prompt ``` -------------------------------- ### Ruby Verification Command Source: https://github.com/openai/codex-universal/blob/main/_autodocs/scripts-api.md Verifies the Ruby runtime installation. ```bash ruby --version ``` -------------------------------- ### Full-Stack JavaScript and Python Development Workflow Source: https://github.com/openai/codex-universal/blob/main/_autodocs/language-toolchains.md Example of setting up Node.js and Python environments within the container for a full-stack development workflow. Mounts the current directory and sets the working directory inside the container. ```bash docker run --rm -it \ -e CODEX_ENV_NODE_VERSION=20 \ -e CODEX_ENV_PYTHON_VERSION=3.12 \ -v $(pwd):/workspace \ -w /workspace \ ghcr.io/openai/codex-universal:latest # Inside container: npm install # Install Node dependencies python3 -m venv venv # Create Python virtual env source venv/bin/activate # Activate Python venv pip install -r requirements.txt # Install Python dependencies npm run build # Build frontend python api/main.py # Run Python backend ``` -------------------------------- ### Docker Container Execution Flow Source: https://github.com/openai/codex-universal/blob/main/_autodocs/scripts-api.md Illustrates the sequence of script executions when a Docker container starts, from initial container startup to the execution of user-provided commands. ```text 1. Docker starts container ↓ 2. ENTRYPOINT executes /opt/entrypoint.sh ↓ 3. entrypoint.sh prints welcome message ↓ 4. entrypoint.sh calls /opt/codex/setup_universal.sh ↓ 5. setup_universal.sh reads CODEX_ENV_* variables ↓ 6. setup_universal.sh configures each language version ↓ 7. entrypoint.sh prints "Environment ready" ↓ 8. entrypoint.sh execs bash --login [ARGS] ↓ 9. Interactive shell or command executes ``` -------------------------------- ### Configure Go and GolangCI Lint Versions Source: https://github.com/openai/codex-universal/blob/main/_autodocs/dockerfile-reference.md Defines the Go versions and the golangci-lint version to be installed. These are used by the mise package manager. ```dockerfile ARG GO_VERSIONS="1.25.1 1.24.3 1.23.8 1.22.12" ARG GOLANG_CI_LINT_VERSION=2.1.6 ``` -------------------------------- ### Install Erlang and Elixir Versions Source: https://github.com/openai/codex-universal/blob/main/_autodocs/dockerfile-reference.md Installs specific versions of Erlang and Elixir using the mise package manager. Elixir is built against the specified Erlang OTP version. ```dockerfile ARG ERLANG_VERSION=27.1.2 ARG ELIXIR_VERSION=1.18.3 mise install "erlang@${ERLANG_VERSION}" "elixir@${ELIXIR_VERSION}-otp-27" ``` -------------------------------- ### Swift Verification Command Source: https://github.com/openai/codex-universal/blob/main/_autodocs/scripts-api.md Verifies the Swift compiler installation. ```bash swift --version ``` -------------------------------- ### Go: Run Linter Source: https://github.com/openai/codex-universal/blob/main/_autodocs/usage-guide.md Runs the golangci-lint linter on the Go project. Assumes Go 1.23.8 environment and golangci-lint is installed. ```bash docker run --rm \ -e CODEX_ENV_GO_VERSION=1.23.8 \ -v $(pwd):/workspace \ -w /workspace \ ghcr.io/openai/codex-universal:latest \ golangci-lint run ./... ``` -------------------------------- ### Manage Project with Poetry Source: https://github.com/openai/codex-universal/blob/main/_autodocs/language-toolchains.md Utilize Poetry for creating new projects, adding dependencies, and installing them. Poetry handles dependency resolution and packaging. ```bash poetry new my-project cd my-project poetry add requests poetry install ``` -------------------------------- ### PHP Verification Commands Source: https://github.com/openai/codex-universal/blob/main/_autodocs/scripts-api.md Verifies PHP runtime and Composer installation. ```bash php --version composer --version ``` -------------------------------- ### List Installed Ruby Versions Source: https://github.com/openai/codex-universal/blob/main/_autodocs/language-toolchains.md Displays all Ruby versions currently managed by the mise version manager. ```bash mise list ruby ``` -------------------------------- ### Python Verification Commands Source: https://github.com/openai/codex-universal/blob/main/_autodocs/scripts-api.md Verifies Python installation and lists available versions managed by pyenv. ```bash #!/bin/bash --login verify ``` ```bash python3 --version pyenv versions | sed 's/^/ /' ``` -------------------------------- ### Node.js: Use Yarn for Dependencies Source: https://github.com/openai/codex-universal/blob/main/_autodocs/usage-guide.md Installs and builds a Node.js project using Yarn. Assumes yarn.lock and package.json are present. ```bash docker run --rm -it \ -e CODEX_ENV_NODE_VERSION=20 \ -v $(pwd):/workspace \ -w /workspace \ ghcr.io/openai/codex-universal:latest # Inside container: root@a1b2c3d4e5f6:/workspace# yarn install root@a1b2c3d4e5f6:/workspace# yarn build ``` -------------------------------- ### Select Java Versions Based on Architecture Source: https://github.com/openai/codex-universal/blob/main/_autodocs/dockerfile-reference.md Dynamically selects the Java versions to install based on the target architecture (amd64 or arm64). ```dockerfile JAVA_VERSIONS="$( [ "$TARGETARCH" = "arm64" ] && echo "$ARM_JAVA_VERSIONS" || echo "$AMD_JAVA_VERSIONS" )" ``` -------------------------------- ### Define Swift Versions Argument Source: https://github.com/openai/codex-universal/blob/main/_autodocs/dockerfile-reference.md Defines the argument for specifying multiple Swift compiler versions to be installed. ```dockerfile ARG SWIFT_VERSIONS="6.2 6.1 5.10" ``` -------------------------------- ### Check Elixir Version Source: https://github.com/openai/codex-universal/blob/main/_autodocs/language-toolchains.md Use this command to verify the installed Elixir version. ```bash elixir --version ``` -------------------------------- ### List Installed PHP Versions Source: https://github.com/openai/codex-universal/blob/main/_autodocs/language-toolchains.md Displays all PHP versions currently managed by the phpenv version manager. ```bash phpenv versions ``` -------------------------------- ### Install Bazel Build System Version Source: https://github.com/openai/codex-universal/blob/main/_autodocs/dockerfile-reference.md Sets the Bazel version to be used during the build. Bazelisk is used as a launcher to manage Bazel versions. ```dockerfile ARG BAZELISK_VERSION=v1.26.0 ``` -------------------------------- ### Setup Script Shebang and Initialization Source: https://github.com/openai/codex-universal/blob/main/_autodocs/scripts-api.md This snippet shows the shebang line for a bash login shell and the error handling configuration. It sources the login shell and sets options to exit on error, undefined variables, or pipe failures. ```bash #!/bin/bash --login set -euo pipefail ``` -------------------------------- ### Base Docker Image Source: https://github.com/openai/codex-universal/blob/main/_autodocs/dockerfile-reference.md Specifies the base operating system image for the Docker build. This example uses Ubuntu 24.04 LTS. ```dockerfile FROM ubuntu:24.04 ``` -------------------------------- ### Create, Build, and Run Swift Package Source: https://github.com/openai/codex-universal/blob/main/_autodocs/language-toolchains.md Initializes a new Swift executable package, builds it, and then runs the executable. ```bash swift package init --type executable swift build swift run ``` -------------------------------- ### List Installed Python Versions Source: https://github.com/openai/codex-universal/blob/main/_autodocs/language-toolchains.md Use the `pyenv versions` command to see all Python versions managed by pyenv within the environment. ```bash pyenv versions ``` -------------------------------- ### Node.js: Use pnpm for Monorepo Source: https://github.com/openai/codex-universal/blob/main/_autodocs/usage-guide.md Installs and builds a Node.js project using pnpm, suitable for monorepos. Assumes pnpm is configured and package.json exists. ```bash docker run --rm -it \ -e CODEX_ENV_NODE_VERSION=20 \ -v $(pwd):/workspace \ -w /workspace \ ghcr.io/openai/codex-universal:latest # Inside container: root@a1b2c3d4e5f6:/workspace# pnpm install root@a1b2c3d4e5f6:/workspace# pnpm run build ``` -------------------------------- ### Configure Rust Toolchain Path Source: https://github.com/openai/codex-universal/blob/main/_autodocs/dockerfile-reference.md Sets environment variables to include Go binary directories in the system's PATH. Note: This snippet appears to be misplaced in the Rust section and likely belongs to a Go installation stage. ```dockerfile ENV PATH=/usr/local/go/bin:$HOME/go/bin:$PATH ``` -------------------------------- ### Java/Gradle: Create, Build, and Run Project Source: https://github.com/openai/codex-universal/blob/main/_autodocs/usage-guide.md Initializes a new Java application project using Gradle, builds it, and then runs it. Assumes Java 21 environment. ```bash docker run --rm -it \ -e CODEX_ENV_JAVA_VERSION=21 \ -v $(pwd):/workspace \ -w /workspace \ ghcr.io/openai/codex-universal:latest # Inside container: root@a1b2c3d4e5f6:/workspace# gradle init --type java-application root@a1b2c3d4e5f6:/workspace# gradle build root@a1b2c3d4e5f6:/workspace# gradle run ``` -------------------------------- ### Set Up Node.js Development Environment Source: https://github.com/openai/codex-universal/blob/main/_autodocs/README.md Launch a Docker container with a specified Node.js version, mapping the current directory to the workspace and setting it as the working directory. ```bash # Node.js development docker run --rm -it \ -e CODEX_ENV_NODE_VERSION=20 \ -v $(pwd):/workspace \ -w /workspace \ ghcr.io/openai/codex-universal:latest ``` -------------------------------- ### Install Specific npm Versions for Node.js Source: https://github.com/openai/codex-universal/blob/main/_autodocs/language-toolchains.md Install specific versions of npm for different Node.js installations using nvm and npm's global install command. This ensures compatibility between Node.js and npm versions. ```dockerfile nvm install 18 && npm install -g npm@10.9 # Node 18 uses npm 10.9 nvm install 20 && npm install -g npm@11.4 # Node 20-24 use npm 11.4 ``` -------------------------------- ### Configure Multiple Languages in a Single Command Source: https://github.com/openai/codex-universal/blob/main/_autodocs/configuration.md This example demonstrates how to set environment variables to configure multiple language versions for the codex-universal container in a single docker run command. All configured versions are applied sequentially during container startup. ```bash docker run --rm -it \ -e CODEX_ENV_PYTHON_VERSION=3.12 \ -e CODEX_ENV_NODE_VERSION=20 \ -e CODEX_ENV_RUST_VERSION=1.87.0 \ -e CODEX_ENV_GO_VERSION=1.23.8 \ -e CODEX_ENV_JAVA_VERSION=21 \ ghcr.io/openai/codex-universal:latest ``` -------------------------------- ### Build Go Binary Source: https://github.com/openai/codex-universal/blob/main/_autodocs/language-toolchains.md Compiles the Go project into an executable binary named 'myapp'. ```bash go build -o myapp . ``` -------------------------------- ### Build C++ Project with CMake Source: https://github.com/openai/codex-universal/blob/main/_autodocs/language-toolchains.md Set up a build directory, configure the CMake project, and compile using make. ```bash mkdir build && cd build cmake .. make ``` -------------------------------- ### Create New Go Module and Add Package Source: https://github.com/openai/codex-universal/blob/main/_autodocs/language-toolchains.md Initializes a new Go module in a project directory and adds a specified package dependency. ```bash mkdir my-project && cd my-project go mod init github.com/user/my-project go get github.com/some/package ``` -------------------------------- ### Set Up Python Development Environment Source: https://github.com/openai/codex-universal/blob/main/_autodocs/README.md Run a Docker container with a specific Python version, mounting the current directory as a workspace and setting it as the working directory. ```bash # Python development docker run --rm -it \ -e CODEX_ENV_PYTHON_VERSION=3.12 \ -v $(pwd):/workspace \ -w /workspace \ ghcr.io/openai/codex-universal:latest ``` -------------------------------- ### Rust: Create, Build, and Run Project Source: https://github.com/openai/codex-universal/blob/main/_autodocs/usage-guide.md Creates a new Rust project using Cargo, builds it, and then runs the executable. Assumes Rust 1.87.0 environment. ```bash docker run --rm -it \ -e CODEX_ENV_RUST_VERSION=1.87.0 \ -v $(pwd):/workspace \ -w /workspace \ ghcr.io/openai/codex-universal:latest # Inside container: root@a1b2c3d4e5f6:/workspace# cargo new myapp root@a1b2c3d4e5f6:/workspace# cd myapp root@a1b2c3d4e5f6:/workspace/myapp# cargo build root@a1b2c3d4e5f6:/workspace/myapp# cargo run ``` -------------------------------- ### Compile and Run Swift File Source: https://github.com/openai/codex-universal/blob/main/_autodocs/language-toolchains.md Compiles a Swift source file named 'main.swift' into an executable 'myapp' and then runs it. ```bash swiftc main.swift -o myapp ./myapp ``` -------------------------------- ### Manual Verification with Custom Versions Source: https://github.com/openai/codex-universal/blob/main/_autodocs/scripts-api.md Illustrates running the verification script with specific, custom environment variables for language versions. ```bash docker run --rm \ -e PYTHON_VERSIONS="3.12 3.11" \ -e NODE_VERSIONS="20 18" \ ghcr.io/openai/codex-universal:latest \ /opt/verify.sh ``` -------------------------------- ### Install and Run with pnpm Source: https://github.com/openai/codex-universal/blob/main/_autodocs/language-toolchains.md pnpm is a preferred package manager for monorepos. Use `pnpm install` for dependencies and `pnpm run build` for build tasks. ```bash pnpm install pnpm run build ``` -------------------------------- ### List Available Software Versions in Container Source: https://github.com/openai/codex-universal/blob/main/_autodocs/usage-guide.md This command lists the available versions of Python, Node.js, Rust, and Go that can be managed within the container. ```bash docker run --rm ghcr.io/openai/codex-universal:latest \ bash -c \ "echo 'Python:'; pyenv versions | sed 's/^/ /' echo 'Node:'; nvm list | sed 's/^/ /' echo 'Rust:'; rustup toolchain list | sed 's/^/ /' echo 'Go:'; mise list go | sed 's/^/ /' " ``` -------------------------------- ### Configure PHP Versions for Installation Source: https://github.com/openai/codex-universal/blob/main/_autodocs/dockerfile-reference.md Specifies the PHP versions to be installed using the phpenv tool. This build argument controls which versions are compiled from source. ```dockerfile ARG PHP_VERSIONS="8.5 8.4 8.3 8.2" ``` -------------------------------- ### Run Verification Script for Installed Languages Source: https://github.com/openai/codex-universal/blob/main/_autodocs/dockerfile-reference.md Executes a verification script to validate that all installed languages and their versions are functional. It uses build variables to determine which languages to check. ```dockerfile "/opt/verify.sh" ``` -------------------------------- ### Create and Test Elixir Project Source: https://github.com/openai/codex-universal/blob/main/_autodocs/language-toolchains.md Commands to create a new Elixir project, navigate into it, and run its tests. ```bash mix new my_app cd my_app mix test ``` -------------------------------- ### Install Global Python Packages Source: https://github.com/openai/codex-universal/blob/main/_autodocs/language-toolchains.md Install common Python development tools like linters, formatters, and type checkers globally for a specific Python version. This command should be run for each Python version managed by pyenv. ```bash # For each Python version: $VERSION/bin/python -m pip install \ ruff black mypy pyright isort pytest ``` -------------------------------- ### Elixir Verification Commands Source: https://github.com/openai/codex-universal/blob/main/_autodocs/scripts-api.md Verifies Elixir and Erlang/OTP installation. ```bash elixir --version erl -version erl -eval 'erlang:display(erlang:system_info(otp_release)), halt().' -noshell ``` -------------------------------- ### Multi-Architecture Build with Buildx Source: https://github.com/openai/codex-universal/blob/main/_autodocs/dockerfile-reference.md Performs a multi-architecture build (amd64 and arm64) using Docker Buildx, tags the image, and pushes it to a registry. Ensure buildx is set up. ```bash docker buildx build \ --platform linux/amd64,linux/arm64 \ -t ghcr.io/openai/codex-universal:latest \ --push \ . ``` -------------------------------- ### Manual Verification in Container Source: https://github.com/openai/codex-universal/blob/main/_autodocs/scripts-api.md Shows how to manually run the verification script on a pre-built Docker image. ```bash docker run --rm ghcr.io/openai/codex-universal:latest /opt/verify.sh ``` -------------------------------- ### Rust Verification Commands Source: https://github.com/openai/codex-universal/blob/main/_autodocs/scripts-api.md Verifies Rust compiler and Cargo installation. ```bash rustc --version cargo --version ``` -------------------------------- ### Create and Compile a Maven Java Project Source: https://github.com/openai/codex-universal/blob/main/_autodocs/language-toolchains.md Generates a new Maven project with specified group and artifact IDs, compiles the code, and prepares for execution. ```bash mvn archetype:generate \ -DgroupId=com.example \ -DartifactId=my-app cd my-app mvn compile mvn exec:java ``` -------------------------------- ### Define Python Versions Argument Source: https://github.com/openai/codex-universal/blob/main/_autodocs/dockerfile-reference.md Defines the argument for specifying multiple Python versions to be installed. ```dockerfile ARG PYTHON_VERSIONS="3.14 3.13 3.12 3.11 3.10" ``` -------------------------------- ### Copy and Set Entrypoint Script Source: https://github.com/openai/codex-universal/blob/main/_autodocs/dockerfile-reference.md Copies the entrypoint script into the image, makes it executable, and sets it as the Docker container's entrypoint. This script defines the container's startup behavior. ```dockerfile COPY entrypoint.sh /opt/entrypoint.sh RUN chmod +x /opt/entrypoint.sh ENTRYPOINT ["/opt/entrypoint.sh"] ``` -------------------------------- ### Swift Version Configuration Source: https://github.com/openai/codex-universal/blob/main/_autodocs/scripts-api.md Configures the Swift version using swiftly. This runs only if the requested version differs from the current one, comparing major.minor versions. ```bash # Swift (lines 65-72): Only runs if version differs # Detects current: swift --version parsed with sed # Compares with requested version (major.minor only) # If different: swiftly use ${version} ``` -------------------------------- ### Start Interactive Ruby Shell Source: https://github.com/openai/codex-universal/blob/main/_autodocs/language-toolchains.md Launches the Interactive Ruby (IRB) console for running Ruby commands interactively. ```bash irb ``` -------------------------------- ### Execution with Environment Variables Source: https://github.com/openai/codex-universal/blob/main/_autodocs/scripts-api.md Shows how to set specific language versions using environment variables when launching the Docker container. ```bash docker run --rm -it \ -e CODEX_ENV_PYTHON_VERSION=3.12 \ -e CODEX_ENV_NODE_VERSION=20 \ ghcr.io/openai/codex-universal:latest ``` -------------------------------- ### Run GolangCI-Lint Source: https://github.com/openai/codex-universal/blob/main/_autodocs/language-toolchains.md Executes the golangci-lint tool to perform static analysis on the current Go project's packages. ```bash golangci-lint run ./... ``` -------------------------------- ### Go Version Configuration Source: https://github.com/openai/codex-universal/blob/main/_autodocs/scripts-api.md Configures the Go version using mise. This runs only if the requested version differs from the current one. It compares versions in the 'go1.23.8' format. ```bash # Go (lines 56-63): Only runs if version differs # Detects current: go version | awk '{print $3}' → "go1.23.8" # Compares with `go${requested_version}` format # If different: mise use --global go@${version} ``` -------------------------------- ### Python: Run Pytest Tests Source: https://github.com/openai/codex-universal/blob/main/_autodocs/usage-guide.md Executes pytest tests located in the tests/ directory within the container. Ensure pytest is installed. ```bash docker run --rm \ -e CODEX_ENV_PYTHON_VERSION=3.12 \ -v $(pwd):/workspace \ -w /workspace \ ghcr.io/openai/codex-universal:latest \ pytest tests/ ``` -------------------------------- ### Configure Swiftly Path Source: https://github.com/openai/codex-universal/blob/main/_autodocs/dockerfile-reference.md Sets environment variables to include the Swiftly binary directory in the system's PATH. ```dockerfile ENV SWIFTLY_BIN_DIR=/root/.swiftly/bin ENV PATH=$SWIFTLY_BIN_DIR:$PATH ``` -------------------------------- ### Create and Activate Virtual Environment Source: https://github.com/openai/codex-universal/blob/main/_autodocs/language-toolchains.md Create a new virtual environment using the `venv` module and activate it by sourcing the `activate` script. This isolates project dependencies. ```bash python3 -m venv /tmp/myenv source /tmp/myenv/bin/activate ``` -------------------------------- ### Node.js: Run Linting and Formatting Source: https://github.com/openai/codex-universal/blob/main/_autodocs/usage-guide.md Executes ESLint for linting and Prettier for code formatting on the Node.js project. Assumes these tools are configured. ```bash docker run --rm \ -e CODEX_ENV_NODE_VERSION=20 \ -v $(pwd):/workspace \ -w /workspace \ ghcr.io/openai/codex-universal:latest # Inside container: root@a1b2c3d4e5f6:/workspace# npx eslint . root@a1b2c3d4e5f6:/workspace# npx prettier --write . ``` -------------------------------- ### Compile and Run a Java File Source: https://github.com/openai/codex-universal/blob/main/_autodocs/language-toolchains.md Compiles a single Java source file into bytecode and then executes the compiled class. ```bash javac HelloWorld.java java HelloWorld ``` -------------------------------- ### Start Interactive Debugging Shell Source: https://github.com/openai/codex-universal/blob/main/_autodocs/usage-guide.md Launch an interactive bash shell within the container, pre-configured with a specific Python version. Useful for manual debugging. ```bash docker run --rm -it \ -e CODEX_ENV_PYTHON_VERSION=3.12 \ ghcr.io/openai/codex-universal:latest \ bash -l # Now you can debug manually root@a1b2c3d4e5f6:/# which python3 /root/.pyenv/shims/python3 root@a1b2c3d4e5f6:/# python3 --version Python 3.12.0 ``` -------------------------------- ### Codex Universal Documentation Navigation Source: https://github.com/openai/codex-universal/blob/main/_autodocs/MANIFEST.md Illustrates the hierarchical structure of the documentation, guiding users through different aspects of the project from overview to specific technical details. ```markdown START → README.md (overview) ↓ index.md (choose task) ↓ Choose path: ├─ "What is it?" → project-overview.md ├─ "How to use?" → usage-guide.md ├─ "How to configure?" → configuration.md ├─ "How languages work?" → language-toolchains.md ├─ "How scripts work?" → scripts-api.md └─ "What's in image?" → dockerfile-reference.md ``` -------------------------------- ### Running Codex Universal with Persistent Caches Source: https://github.com/openai/codex-universal/blob/main/_autodocs/usage-guide.md This command keeps the container running to preserve caches for npm, pip, and cargo. Subsequent installs will be significantly faster due to caching. ```bash # Keep container running to preserve caches docker run --rm -it \ -e CODEX_ENV_PYTHON_VERSION=3.12 \ -v $(pwd):/workspace \ -w /workspace \ ghcr.io/openai/codex-universal:latest # npm, pip, cargo caches persist while container is running root@a1b2c3d4e5f6:/workspace# npm install # First time: 30s root@a1b2c3d4e5f6:/workspace# npm install # Second time: 1s (cached) ``` -------------------------------- ### Python: Format and Lint Code Source: https://github.com/openai/codex-universal/blob/main/_autodocs/usage-guide.md Applies code formatting with Black, checks code style with Ruff, and performs type checking with Mypy. Assumes these tools are installed or available. ```bash docker run --rm \ -e CODEX_ENV_PYTHON_VERSION=3.12 \ -v $(pwd):/workspace \ -w /workspace \ ghcr.io/openai/codex-universal:latest # Inside container: root@a1b2c3d4e5f6:/workspace# black . root@a1b2c3d4e5f6:/workspace# ruff check . root@a1b2c3d4e5f6:/workspace# mypy src/ ```