Skip to content

Commit 6a15f5c

Browse files
tmikovclaude
andcommitted
Add Dockerfiles for Ubuntu 24.04 and Fedora 42
Add Dockerfiles with all build dependencies pre-installed for building the project in isolated containers. Update README with Docker build instructions explaining that npm install must be run on the host first. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 879725b commit 6a15f5c

File tree

3 files changed

+70
-0
lines changed

3 files changed

+70
-0
lines changed

Dockerfile.fedora42

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM fedora:42
2+
3+
# Install build dependencies for imgui-react-runtime
4+
RUN dnf install -y \
5+
git \
6+
nodejs npm \
7+
clang \
8+
cmake \
9+
ninja-build \
10+
libX11-devel \
11+
libXi-devel \
12+
libXcursor-devel \
13+
mesa-libGL-devel \
14+
libicu-devel \
15+
&& dnf clean all

Dockerfile.ubuntu2404

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
FROM ubuntu:24.04
2+
3+
# Install build dependencies for imgui-react-runtime
4+
RUN apt-get update && apt-get install -y \
5+
git \
6+
curl \
7+
clang \
8+
cmake \
9+
ninja-build \
10+
libx11-dev \
11+
libxi-dev \
12+
libxcursor-dev \
13+
libgl1-mesa-dev \
14+
libicu-dev \
15+
&& rm -rf /var/lib/apt/lists/*
16+
17+
# Install Node.js 20 from NodeSource
18+
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
19+
&& apt-get install -y nodejs \
20+
&& rm -rf /var/lib/apt/lists/*

README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ _**Note**: This project is an independent experiment and is not affiliated with,
3131
- [Supported Platforms](#supported-platforms)
3232
- [Build Requirements](#build-requirements)
3333
- [Quick Start](#quick-start)
34+
- [Building with Docker](#building-with-docker)
3435
- [Examples](#examples)
3536
- [Hello World](#hello-world)
3637
- [Showcase](#showcase)
@@ -154,6 +155,40 @@ cmake --build cmake-build-debug
154155

155156
You should see the showcase window with multiple demos, background decorations, and interactive controls!
156157

158+
### Building with Docker
159+
160+
Docker images are provided for building on Linux without installing dependencies locally. This is useful for CI, testing on different distributions, or keeping your host system clean.
161+
162+
**Available Dockerfiles:**
163+
- `Dockerfile.ubuntu2404` - Ubuntu 24.04 LTS with Clang 18
164+
- `Dockerfile.fedora42` - Fedora 42 with Clang 20
165+
166+
**Build the Docker image (one-time setup):**
167+
```bash
168+
docker build -t imgui-ubuntu2404 -f Dockerfile.ubuntu2404 .
169+
# or
170+
docker build -t imgui-fedora42 -f Dockerfile.fedora42 .
171+
```
172+
173+
**Build the project:**
174+
175+
First, run `npm install` on your host machine (only needed once):
176+
```bash
177+
npm install
178+
```
179+
180+
Then build inside Docker, running as your current user so build artifacts are owned by you:
181+
```bash
182+
docker run --rm -u $(id -u):$(id -g) -v $(pwd):/work -w /work imgui-ubuntu2404 \
183+
bash -c "cmake -B cmake-build-ubuntu -DCMAKE_BUILD_TYPE=Debug -G Ninja \
184+
-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ && \
185+
cmake --build cmake-build-ubuntu"
186+
```
187+
188+
The build output will be in `cmake-build-ubuntu/` (or whichever build directory you specify), owned by your user.
189+
190+
**Note:** Running GUI applications from Docker requires additional setup (X11 forwarding), but building works out of the box.
191+
157192
## Examples
158193

159194
The project includes three example applications that demonstrate different features.

0 commit comments

Comments
 (0)