Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,21 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
&& rm -rf /var/lib/apt/lists/* \
&& bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"

### PHP ###

ARG PHP_VERSIONS="8.2 8.3 8.4"

RUN add-apt-repository -y ppa:ondrej/php
RUN apt-get update && \
for v in $PHP_VERSIONS; do \
apt-get install -y --no-install-recommends \
php${v} php${v}-cli php${v}-dev \
php${v}-xml php${v}-mbstring php${v}-curl php${v}-zip php${v}-bcmath; \
done && \
apt-get install -y --no-install-recommends composer && \
rm -rf /var/lib/apt/lists/*
ENV PATH="/root/.config/composer/vendor/bin:$PATH"

### SETUP SCRIPTS ###

COPY setup_universal.sh /opt/codex/setup_universal.sh
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ docker run --rm -it \
-e CODEX_ENV_RUST_VERSION=1.87.0 \
-e CODEX_ENV_GO_VERSION=1.23.8 \
-e CODEX_ENV_SWIFT_VERSION=6.1 \
-e CODEX_ENV_PHP_VERSION=8.4 \
# Mount the current directory similar to how it would get cloned in.
-v $(pwd):/workspace/$(basename $(pwd)) -w /workspace/$(basename $(pwd)) \
ghcr.io/openai/codex-universal:latest
Expand All @@ -42,6 +43,7 @@ The following environment variables can be set to configure runtime installation
| `CODEX_ENV_RUST_VERSION` | Rust version to install | `1.83.0`, `1.84.1`, `1.85.1`, `1.86.0`, `1.87.0` | |
| `CODEX_ENV_GO_VERSION` | Go version to install | `1.22.12`, `1.23.8`, `1.24.3` | |
| `CODEX_ENV_SWIFT_VERSION` | Swift version to install | `5.10`, `6.1` | |
| `CODEX_ENV_PHP_VERSION` | PHP version to install | `8.2`, `8.3`, `8.4`, | `composer` |

## What's included

Expand Down
12 changes: 12 additions & 0 deletions setup_universal.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ CODEX_ENV_NODE_VERSION=${CODEX_ENV_NODE_VERSION:-}
CODEX_ENV_RUST_VERSION=${CODEX_ENV_RUST_VERSION:-}
CODEX_ENV_GO_VERSION=${CODEX_ENV_GO_VERSION:-}
CODEX_ENV_SWIFT_VERSION=${CODEX_ENV_SWIFT_VERSION:-}
CODEX_ENV_PHP_VERSION=${CODEX_ENV_PHP_VERSION:-}

echo "Configuring language runtimes..."

Expand Down Expand Up @@ -60,3 +61,14 @@ if [ -n "${CODEX_ENV_SWIFT_VERSION}" ]; then
swiftly install --use "${CODEX_ENV_SWIFT_VERSION}"
fi
fi

if [ -n "${CODEX_ENV_PHP_VERSION}" ]; then
echo "# PHP: ${CODEX_ENV_PHP_VERSION}"
bin="/usr/bin/php${CODEX_ENV_PHP_VERSION}"
if [ ! -x "$bin" ]; then
echo "❌ PHP $CODEX_ENV_PHP_VERSION not installed (check supported list)"; exit 1
fi
update-alternatives --set php $bin
update-alternatives --set phpize /usr/bin/phpize${CODEX_ENV_PHP_VERSION}
update-alternatives --set php-config /usr/bin/php-config${CODEX_ENV_PHP_VERSION}
fi