Skip to content
RussellFSJPublic

About

Portable Docker development environment for 42 Singapore projects, featuring campus-compatible tooling for off-campus development and testing, cross-platform support, and optional AI CLI integration without requiring host-level installation.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

42-devbox

A Docker development environment for 42 Singapore projects. Includes Ubuntu, GCC/G++, Clang, Make, CMake, GDB, Valgrind, and Norminette. The optional Codex image adds Node.js and OpenAI Codex CLI. The optional Claude image adds Anthropic's Claude Code CLI.

Keep this repository alongside your projects:

workspace/
├── 42-devbox/
│   ├── .env
│   ├── Dockerfile
│   ├── docker-compose.yml
│   ├── install-norminette.sh
│   └── README.md
├── 42-tutor/          # Optional
├── libft/
├── minishell/
├── philosophers/
└── ...

Compose mounts the parent directory at /workspace, exposing this repository and its sibling projects. The container shell starts in /workspace.

Run Docker and Compose commands on the host from workspace/42-devbox with Docker running.

Configure

Copy the example configuration if you need local overrides. This preserves an existing .env:

cp -n .env.example .env

Compose reads .env automatically. Exported shell variables take precedence; omitted or empty settings use the defaults below. No .env file is required to run with these defaults.

# Host folder mounted at /workspace; relative to this repository.
WORKSPACE_DIR=..

# 42 Tutor checkout path relative to WORKSPACE_DIR.
TUTOR_DIR=42-tutor

# Host directory for persistent Codex and Claude state, relative to this repository.
DEVBOX_DATA_DIR=./.devbox-data

# Local image names and tags.
DEV_IMAGE=42-devbox:dev
CODEX_IMAGE=42-devbox:codex
CLAUDE_IMAGE=42-devbox:claude

# Build and runtime architecture.
DOCKER_PLATFORM=linux/amd64

# Base image release.
UBUNTU_VERSION=22.04

# Compiler major versions; GCC_VERSION also selects G++.
GCC_VERSION=12
CLANG_VERSION=12

# Pinned Norminette version.
NORMINETTE_VERSION=3.3.60

# Codex image: Node.js major release and pinned CLI version.
NODE_MAJOR=22
CODEX_VERSION=0.174.0

# Claude Code release channel or exact version.
CLAUDE_VERSION=stable

Set WORKSPACE_DIR to an absolute path to mount a different workspace. Compiler versions must be available in the selected Ubuntu release. After updating versions, rebuild with the relevant command below.

Set DEVBOX_DATA_DIR to move agent state. Use an absolute path or a path starting with ./ or ../ relative to this repository. If you override it, use that path in the mkdir commands below and keep the directory outside Git. To reuse existing state, copy the codex/ and claude/ folders to the new location before starting the containers.

Run the development container

Build the image and open a shell:

docker compose run --rm --build 42-dev

Build a project from the mounted workspace:

cd /workspace/<project-name>
make

Run with Codex

Create the state directory, then build the Codex image and open a shell:

mkdir -p -m 700 .devbox-data
docker compose run --rm --build 42-codex

Run codex inside the container. Configuration and credentials persist in ${DEVBOX_DATA_DIR}/codex/, mounted at /root/.codex in the container. Targeting 42-codex explicitly enables its codex profile.

Run with Claude Code

Create the state directory, then build the Claude image and open a shell:

mkdir -p -m 700 .devbox-data
docker compose run --rm --build 42-claude

Inside the container, change to your project directory and run claude. Follow the sign-in prompts on first use. Your login, settings, and sessions persist in ${DEVBOX_DATA_DIR}/claude/, mounted at /claude-home in the container. Targeting 42-claude explicitly enables its claude profile. A plain docker compose up starts only 42-dev.

The image uses Anthropic's native installer and defaults to the stable release channel. Set CLAUDE_VERSION to pin a release. To refresh the stable release, run docker compose build --no-cache 42-claude. Updates are managed through image builds.

Use 42 Tutor

With the default workspace, clone the tutor alongside this repo from workspace/42-devbox.

git clone https://github.com/RussellFSJ/42-tutor.git ../42-tutor

For a different layout, set TUTOR_DIR in .env to a path relative to WORKSPACE_DIR. The checkout is at ${WORKSPACE_DIR}/${TUTOR_DIR} on the host and /workspace/${TUTOR_DIR} in the containers.

At startup, both agent images look for the checkout’s .agents/skills directory. Codex links it at $HOME/.agents/skills/42-tutor. Claude Code links each skill under $HOME/.claude/skills. Startup preserves existing entries and skips linking if the skills directory is missing.

Follow the tutor repo’s installation instructions to set up the student policy in your project. Then launch your agent from the project directory. In Codex, use /skills to check for the 42-* skills. In Claude Code, look for them in the slash menu. 42 Tutor project setup

To develop tutor skills, open a separate session in /workspace/${TUTOR_DIR}. The links point to the live checkout, so edits are available without rebuilding the images. Start a fresh session if a running one misses a change. On Linux, edits made as container root can create root-owned files on the host.

Exit

Run exit to stop and remove the temporary container. Workspace files and ${DEVBOX_DATA_DIR}/ persist. Git and Docker builds both ignore the default .devbox-data/ directory. If you used an earlier version with named volumes, your existing state is still in those volumes. Copy it into the corresponding agent state folder to reuse it.

Pull from Docker Hub

Pull the Linux AMD64 image for the service you want:

docker pull --platform linux/amd64 russellfsj/42-devbox:latest
docker pull --platform linux/amd64 russellfsj/42-devbox:codex-latest
docker pull --platform linux/amd64 russellfsj/42-devbox:claude-latest

To run a pulled image with Compose, set the corresponding image variable and pass --no-build. Tutor skill linking requires an image built with the shared startup script.

For example, to open the development shell:

DEV_IMAGE=russellfsj/42-devbox:latest docker compose run --rm --no-build 42-dev

To open a shell with Codex:

mkdir -p -m 700 .devbox-data
CODEX_IMAGE=russellfsj/42-devbox:codex-latest docker compose run --rm --no-build 42-codex

To open a shell with Claude Code:

mkdir -p -m 700 .devbox-data
CLAUDE_IMAGE=russellfsj/42-devbox:claude-latest docker compose run --rm --no-build 42-claude

About

Portable Docker development environment for 42 Singapore projects, featuring campus-compatible tooling for off-campus development and testing, cross-platform support, and optional AI CLI integration without requiring host-level installation.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages