Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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: 13 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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" \

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Pin pyenv checkout to keep builds reproducible

This clone no longer pins a pyenv release; git clone without --branch tracks whatever HEAD is on the default branch at build time. That makes the image build non‑reproducible and can break later when upstream changes or removes python-build definitions needed by pyenv install $PYTHON_VERSIONS. Consider restoring a specific tag/commit pin (as before) so builds are stable across time.

Useful? React with 👍 / 👎.

&& 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 \
Expand Down Expand Up @@ -238,7 +237,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 \
Expand Down Expand Up @@ -326,7 +325,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 --network=none chmod +x /opt/verify.sh \
&& bash -lc 'PYTHON_VERSIONS="$PYTHON_VERSIONS" \
NODE_VERSIONS="18 20 22" \
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 ###

Expand Down
50 changes: 42 additions & 8 deletions verify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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]}} \
Comment on lines +27 to +31

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Restore Node default after version loop

Because the loop runs from max-1 down to 0, the last setup_universal.sh invocation uses NODE[0] as the version. With NODE_VERSIONS="18 20 22" in the Dockerfile, that means the final pass sets Node to 18. setup_universal.sh persists this via nvm alias default (setup_universal.sh:27-33), so the built image ends up defaulting to Node 18 instead of the intended NODE_VERSION=22 (Dockerfile:158-182). This changes the runtime version users see and makes the verification output reflect the wrong default. Consider iterating forward, reversing NODE_VERSIONS, or explicitly restoring the desired default after the loop.

Useful? React with 👍 / 👎.

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 -c '
printf "\n\nTesting setup_universal with versions:\n"
env | grep "^CODEX_ENV_" | sort
printf "\n"
exec /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
Expand Down
Loading