diff --git a/Dockerfile b/Dockerfile index 10eeb69..b244633 100644 --- a/Dockerfile +++ b/Dockerfile @@ -118,13 +118,12 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ ### PYTHON ### -ARG PYENV_VERSION=v2.6.10 -ARG PYTHON_VERSIONS="3.10 3.11 3.12 3.13 3.14" +ARG PYTHON_VERSIONS="3.14 3.13 3.12 3.11 3.10" # Install pyenv ENV PYENV_ROOT=/root/.pyenv ENV PATH=$PYENV_ROOT/bin:$PATH -RUN git -c advice.detachedHead=0 clone --branch "$PYENV_VERSION" --depth 1 https://github.com/pyenv/pyenv.git "$PYENV_ROOT" \ +RUN git -c advice.detachedHead=0 clone --depth 1 https://github.com/pyenv/pyenv.git "$PYENV_ROOT" \ && echo 'export PYENV_ROOT="$HOME/.pyenv"' >> /etc/profile \ && echo 'export PATH="$PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH"' >> /etc/profile \ && echo 'eval "$(pyenv init - bash)"' >> /etc/profile \ @@ -132,7 +131,6 @@ RUN git -c advice.detachedHead=0 clone --branch "$PYENV_VERSION" --depth 1 https && src/configure \ && make -C src \ && pyenv install $PYTHON_VERSIONS \ - && pyenv global "${PYTHON_VERSIONS%% *}" \ && rm -rf "$PYENV_ROOT/cache" # Install pipx for common global package managers (e.g. poetry) @@ -238,7 +236,7 @@ RUN --mount=type=cache,target=/root/.cargo/registry \ ### RUBY ### -ARG RUBY_VERSIONS="3.2.3 3.3.8 3.4.4" +ARG RUBY_VERSIONS="3.4.4 3.3.8 3.2.3" RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ --mount=type=cache,target=/var/lib/apt,sharing=locked \ --mount=type=cache,target=/root/.cache/mise \ @@ -326,7 +324,16 @@ RUN chmod +x /opt/codex/setup_universal.sh ### VERIFICATION SCRIPT ### COPY verify.sh /opt/verify.sh -RUN chmod +x /opt/verify.sh && bash -lc "/opt/verify.sh" +RUN chmod +x /opt/verify.sh \ + && PYTHON_VERSIONS="$PYTHON_VERSIONS" \ + NODE_VERSIONS="24 22 20 18" \ + RUST_VERSIONS="$RUST_VERSIONS" \ + GO_VERSIONS="$GO_VERSIONS" \ + SWIFT_VERSIONS="$SWIFT_VERSIONS" \ + RUBY_VERSIONS="$RUBY_VERSIONS" \ + PHP_VERSIONS="$PHP_VERSIONS" \ + JAVA_VERSIONS="$( [ "$TARGETARCH" = "arm64" ] && echo "$ARM_JAVA_VERSIONS" || echo "$AMD_JAVA_VERSIONS" )" \ + "/opt/verify.sh" ### ENTRYPOINT ### diff --git a/setup_universal.sh b/setup_universal.sh index 9507232..6b18136 100644 --- a/setup_universal.sh +++ b/setup_universal.sh @@ -22,6 +22,7 @@ echo "Configuring language runtimes..." if [ -n "${CODEX_ENV_PYTHON_VERSION}" ]; then echo "# Python: ${CODEX_ENV_PYTHON_VERSION}" pyenv global "${CODEX_ENV_PYTHON_VERSION}" + python3 --version fi if [ -n "${CODEX_ENV_NODE_VERSION}" ]; then @@ -29,7 +30,7 @@ if [ -n "${CODEX_ENV_NODE_VERSION}" ]; then echo "# Node.js: v${CODEX_ENV_NODE_VERSION} (default: ${current})" if [ "${current}" != "v${CODEX_ENV_NODE_VERSION}" ]; then nvm alias default "${CODEX_ENV_NODE_VERSION}" - nvm use "${CODEX_ENV_NODE_VERSION}" + nvm use --save "${CODEX_ENV_NODE_VERSION}" corepack enable fi fi @@ -39,6 +40,7 @@ if [ -n "${CODEX_ENV_RUBY_VERSION}" ]; then echo "# Ruby: ${CODEX_ENV_RUBY_VERSION} (default: ${current})" if [ "${current}" != "${CODEX_ENV_RUBY_VERSION}" ]; then mise use --global "ruby@${CODEX_ENV_RUBY_VERSION}" + ruby --version fi fi @@ -47,6 +49,7 @@ if [ -n "${CODEX_ENV_RUST_VERSION}" ]; then echo "# Rust: ${CODEX_ENV_RUST_VERSION} (default: ${current})" if [ "${current}" != "${CODEX_ENV_RUST_VERSION}" ]; then rustup default "${CODEX_ENV_RUST_VERSION}" + rustc --version fi fi @@ -55,6 +58,7 @@ if [ -n "${CODEX_ENV_GO_VERSION}" ]; then echo "# Go: go${CODEX_ENV_GO_VERSION} (default: ${current})" if [ "${current}" != "go${CODEX_ENV_GO_VERSION}" ]; then mise use --global "go@${CODEX_ENV_GO_VERSION}" + go version fi fi @@ -63,6 +67,7 @@ if [ -n "${CODEX_ENV_SWIFT_VERSION}" ]; then echo "# Swift: ${CODEX_ENV_SWIFT_VERSION} (default: ${current})" if [ "${current}" != "${CODEX_ENV_SWIFT_VERSION}" ]; then swiftly use "${CODEX_ENV_SWIFT_VERSION}" + swift --version fi fi @@ -72,6 +77,7 @@ if [ -n "${CODEX_ENV_PHP_VERSION}" ]; then echo "# PHP: ${CODEX_ENV_PHP_VERSION} (default: ${current})" if [ "${current}" != "${CODEX_ENV_PHP_VERSION}" ]; then phpenv global "${CODEX_ENV_PHP_VERSION}snapshot" + php --version fi fi @@ -80,5 +86,6 @@ if [ -n "${CODEX_ENV_JAVA_VERSION}" ]; then echo "# Java: ${CODEX_ENV_JAVA_VERSION} (default: ${current})" if [ "${current}" != "${CODEX_ENV_JAVA_VERSION}" ]; then mise use --global "java@${CODEX_ENV_JAVA_VERSION}" + java -version fi fi diff --git a/verify.sh b/verify.sh index 38cabc8..fe9a5e8 100644 --- a/verify.sh +++ b/verify.sh @@ -4,19 +4,53 @@ set -euo pipefail echo "Verifying language runtimes ..." +read -ra PYTHON <<< "$PYTHON_VERSIONS" +read -ra NODE <<< "$NODE_VERSIONS" +read -ra RUST <<< "$RUST_VERSIONS" +read -ra GO <<< "$GO_VERSIONS" +read -ra SWIFT <<< "$SWIFT_VERSIONS" +read -ra RUBY <<< "$RUBY_VERSIONS" +read -ra PHP <<< "$PHP_VERSIONS" +read -ra JAVA <<< "$JAVA_VERSIONS" + +max=$(printf "%s\n" \ + ${#PYTHON[@]} \ + ${#NODE[@]} \ + ${#RUST[@]} \ + ${#GO[@]} \ + ${#SWIFT[@]} \ + ${#RUBY[@]} \ + ${#PHP[@]} \ + ${#JAVA[@]} \ + | sort -nr | head -1) + +for ((i=max-1; i>=0; i--)); do + CODEX_ENV_PYTHON_VERSION=${PYTHON[i]:-${PYTHON[0]}} \ + CODEX_ENV_NODE_VERSION=${NODE[i]:-${NODE[0]}} \ + CODEX_ENV_RUST_VERSION=${RUST[i]:-${RUST[0]}} \ + CODEX_ENV_GO_VERSION=${GO[i]:-${GO[0]}} \ + CODEX_ENV_SWIFT_VERSION=${SWIFT[i]:-${SWIFT[0]}} \ + CODEX_ENV_RUBY_VERSION=${RUBY[i]:-${RUBY[0]}} \ + CODEX_ENV_PHP_VERSION=${PHP[i]:-${PHP[0]}} \ + CODEX_ENV_JAVA_VERSION=${JAVA[i]:-${JAVA[0]}} \ + bash -lc ' + printf "\n\nTesting setup_universal with versions:\n" + env | grep "^CODEX_ENV_" | sort + printf "\n" + /opt/codex/setup_universal.sh + ' +done + echo "- Python:" python3 --version pyenv versions | sed 's/^/ /' echo "- Node.js:" -for version in "18" "20" "22"; do - nvm use --global "${version}" - node --version - npm --version - pnpm --version - yarn --version - npm ls -g -done +node --version +npm --version +pnpm --version +yarn --version +npm ls -g echo "- Bun:" bun --version