A Dockerised environment and Makefile for interacting with the OpenAI Codex (via the OpenAI CLI) inside a container. This setup isolates your local development environment from the Node.js and OpenAI CLI dependencies.
- Dockerfile: Defines a Node.js container with the OpenAI CLI installed.
- docker-compose.yml: Runs the service with environment variables loaded from a given
.envfile. - Makefile: Provides shortcuts for building, running, and interacting with Codex via Docker:
- Build and manage containers.
- Shell access.
- Dependency install & update.
- Codex completions and edits.
- .env.example: Template for environment variables.
- Docker (v20+)
- Docker Compose plugin (use
docker compose) - An OpenAI API key
- Clone the repository
git clone https://github.com/gocanto/openai-codex.git cd openai-codex - Copy and configure
.envcp .env.example .env
OPENAI_API_KEY: Your OpenAI secret keyNPM_TOKEN: (Optional) Your npm access token for private packages
# either export it directly
export OPENAI_API_KEY="your-api-key-here"
# or put it in a .env file alongside your docker-compose/Makefile:
OPENAI_API_KEY=your-api-key-heremake build # Build the Docker image
make up # Start containers in detached modemake help: See all the available commandsmake build: Build the Docker imagemake up: Start containers in detached modemake logs: View container logsmake shell: Open an interactive shell in the containermake install: Install npm dependencies (npm ci) inside containermake update: Update npm dependencies (npm update) inside containermake start: Run your application (npm start)make down: Stop and remove containers
-
Complete from prompt
make codex-complete prompt="<Describe your coding task>" -
Edit existing file
make codex-edit file=path/to/file prompt="<Edit instructions>"
Outputs (edits or completions) appear in your terminal or overwrite the target file (with a .edited suffix if configured).
Feel free to submit issues or pull requests for enhancements or bug fixes.
This project is licensed under the MIT Licence. See LICENSE for details.