# Codex (Cloud) environment for build and run unit tests?

**URL:** <https://community.openai.com/t/codex-cloud-environment-for-build-and-run-unit-tests/1263843>\
**Category:** Codex\
**Tags:** codex\
**Created:** [May 17, 2025, 3:26pm UTC](https://community.openai.com/t/codex-cloud-environment-for-build-and-run-unit-tests/1263843 "2025-05-17T15:26:08Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![danwhite1](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/danwhite1/32/511247_2.png) [@danwhite1](https://community.openai.com/u/danwhite1)\
**Post date:** [May 17, 2025, 3:26pm UTC](https://community.openai.com/t/codex-cloud-environment-for-build-and-run-unit-tests/1263843/1 "2025-05-17T15:26:08Z")

</div>

What environment does Codex Cloud (May 2025) support for building and running unit tests?

I see that it does not have dotnet installed so it can’t build and verify that the code compiles.

---

<div class="post-metadata">

**Author:** ![lionkeng](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/lionkeng/32/155866_2.png) [@lionkeng](https://community.openai.com/u/lionkeng)\
**Post date:** [May 17, 2025, 3:29pm UTC](https://community.openai.com/t/codex-cloud-environment-for-build-and-run-unit-tests/1263843/2 "2025-05-17T15:29:45Z")

</div>

I see a similar issue too with my tests. But in my case, the container can’t even connect to the registry and install the necessary dependencies for the tooling needed to run my tests in a Python based repo.

---

<div class="post-metadata">

**Author:** ![corey](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/corey/32/556021_2.png) [@corey](https://community.openai.com/u/corey)\
**Post date:** [May 17, 2025, 3:45pm UTC](https://community.openai.com/t/codex-cloud-environment-for-build-and-run-unit-tests/1263843/3 "2025-05-17T15:45:25Z")

</div>

If you go into Environments, choose your repo, click Edit, then expand the Advanced panel you can see more details about this. The code is run in a Docker container using an image based on Ubuntu 24.04, the details of which can be [found on Github here](https://github.com/openai/codex-universal).

The dropdown notes that support for custom Docker images is coming. For now, you may be able to install additional tools using the “Setup script” field as it is run while the container still has internet access. `apt` is installed and available, but I have not personally tried to install anything with it yet so I’m not sure what the limits are.

---

<div class="post-metadata">

**Author:** ![selim.issever](https://avatars.discourse-cdn.com/v4/letter/s/a5b964/32.png) [@selim.issever](https://community.openai.com/u/selim.issever)\
**Post date:** [May 27, 2025, 10:49am UTC](https://community.openai.com/t/codex-cloud-environment-for-build-and-run-unit-tests/1263843/4 "2025-05-27T10:49:51Z")

</div>

For me the following script works (created by ChatGPT) :

```auto
#!/bin/bash
set -e

# Project name (adjust if needed)
PROJECT_NAME=someprojectname

# .NET version (here 8.0, adjust if needed)
DOTNET_VERSION=8.0

# Add Microsoft package source
wget https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
rm packages-microsoft-prod.deb

# Update package sources and transport layer
sudo apt-get update
sudo apt-get install -y apt-transport-https

# Install .NET SDK
sudo apt-get update
sudo apt-get install -y dotnet-sdk-$DOTNET_VERSION

# Test: display version
dotnet --version

# --- IMPORTANT: Restore ALL packages while Internet is available! ---
dotnet restore $PROJECT_NAME.sln

# (Optional: Build and test immediately while Internet is available)
dotnet build $PROJECT_NAME.sln --no-restore
dotnet test $PROJECT_NAME.sln --no-build --no-restore

echo "Setup and pre-restore completed. Container is ready for offline use."

```

---

<div class="post-metadata">

**Author:** ![josh777](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/josh777/32/448547_2.png) [@josh777](https://community.openai.com/u/josh777)\
**Post date:** [June 4, 2025, 4:51pm UTC](https://community.openai.com/t/codex-cloud-environment-for-build-and-run-unit-tests/1263843/5 "2025-06-04T16:51:53Z")

</div>

You the man! I commented out the PROJECT\_NAME and restore/build/test portions, since I don’t necessarily need that in every CODEX environment.
