Skip to content

Commit 7bf68d2

Browse files
authored
Fix docker configurations (#44)
* fix: simplify docker build workflow to be multiplatform * fix: set the slang version to 0.5.10 * docker: fix gpu base image to be compatible with CUDA 12 * docker: remove entrypoints * docker: add bash entrypoint to overwrite base images entrypoint * docs: update README.md * workflow: change naming of docker images * workflow: remove CI triggered by PRs to main * feat: migrate CI docker images push to GHCR * style: fix indentations in README.md and missing command * docs: add section on prebuilt docker images on GHCR in README.md
1 parent 4668761 commit 7bf68d2

5 files changed

Lines changed: 76 additions & 63 deletions

File tree

.github/workflows/docker.yml

Lines changed: 32 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -4,52 +4,32 @@ on:
44
push:
55
branches:
66
- main
7-
8-
pull_request:
9-
branches:
10-
- main
117
workflow_dispatch:
128

139
env:
14-
IMAGE_NAMESPACE: fabnemepfl
15-
REGISTRY: docker.io
10+
IMAGE_NAME: mmirage
11+
REGISTRY: ghcr.io
1612

1713
jobs:
1814
build-docker:
15+
runs-on: ubuntu-latest
16+
permissions:
17+
contents: read
18+
packages: write
1919
strategy:
2020
fail-fast: true
2121
matrix:
2222
include:
23-
- platform: ubuntu-latest
24-
path: docker/Dockerfile
25-
tag_base: amd64
26-
name: mmirage-git
27-
- platform: ubuntu-latest
28-
path: docker/Dockerfile.cpu
29-
tag_base: amd64
30-
name: mmirage-git-cpu
31-
- platform: ubuntu-24.04-arm
32-
path: docker/Dockerfile.cpu
33-
tag_base: arm64
34-
name: mmirage-git-cpu
23+
- path: docker/Dockerfile
24+
suffix: gpu
25+
platforms: linux/amd64
26+
- path: docker/Dockerfile.cpu
27+
suffix: cpu
28+
platforms: linux/amd64,linux/arm64
3529

36-
runs-on: ${{ matrix.platform }}
3730
environment: ${{ github.event_name != 'pull_request' && 'docker' || 'docker-ci' }}
3831

3932
steps:
40-
- name: Free space (ARM)
41-
if: matrix.platform == 'ubuntu-24.04-arm'
42-
run: |
43-
df -h
44-
du -h -d1 /home/runner || true
45-
46-
rm -rf /opt/hostedtoolcache
47-
rm -rf /home/runner/.cache
48-
rm -rf /home/runner/.docker
49-
rm -rf /home/runner/actions-runner/_work/_tool
50-
51-
df -h
52-
5333
- name: Free disk space
5434
uses: jlumbroso/free-disk-space@main
5535
with:
@@ -62,27 +42,40 @@ jobs:
6242
swap-storage: true
6343

6444
- name: Check free space
65-
run: df -h
45+
run: df -h
6646

6747
- name: Checkout repository
6848
uses: actions/checkout@v4
6949

70-
- name: Log in to DockerHub
50+
- name: Log in to GitHub Container Registry (GHCR)
7151
if: github.event_name != 'pull_request'
7252
uses: docker/login-action@v3
7353
with:
74-
username: ${{ secrets.DOCKERHUB_USERNAME }}
75-
password: ${{ secrets.DOCKERHUB_TOKEN }}
54+
registry: ${{ env.REGISTRY }}
55+
username: ${{ github.actor }}
56+
password: ${{ secrets.GITHUB_TOKEN }}
57+
58+
- name: Set up QEMU
59+
uses: docker/setup-qemu-action@v3
7660

7761
- name: Set up Docker Buildx
7862
uses: docker/setup-buildx-action@v3
7963

64+
- name: Docker metadata
65+
id: meta
66+
uses: docker/metadata-action@v5
67+
with:
68+
images: ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}
69+
tags: |
70+
type=raw,value=latest,suffix=-${{ matrix.suffix }}
71+
type=sha,format=long,suffix=-${{ matrix.suffix }}
72+
8073
- name: Build and push
8174
uses: docker/build-push-action@v6
8275
with:
8376
context: .
8477
file: ${{ matrix.path }}
78+
platforms: ${{ matrix.platforms }}
8579
push: ${{ github.event_name != 'pull_request' }}
86-
tags: |
87-
${{ env.REGISTRY }}/${{ env.IMAGE_NAMESPACE }}/${{ matrix.name }}:latest-${{ matrix.tag_base }}
88-
${{ env.REGISTRY }}/${{ env.IMAGE_NAMESPACE }}/${{ matrix.name }}:${{ github.sha }}-${{ matrix.tag_base }}
80+
tags: ${{ steps.meta.outputs.tags }}
81+
labels: ${{ steps.meta.outputs.labels }}

README.md

Lines changed: 40 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,57 +10,77 @@ MMIRAGE, which stands for **M**odular **M**ultimodal **I**ntelligent **R**eforma
1010

1111
## How to install
1212

13-
To install the library, clone it from GitHub and install it with pip. The base
14-
install does not include the local SGLang runtime:
13+
To install the library, clone it from GitHub and install it with pip. The base install does not include the local SGLang runtime:
1514

1615
```bash
1716
git clone git@github.com:EPFLiGHT/MMIRAGE.git
18-
pip install -e ./MMIRAGE
17+
cd MMIRAGE
18+
pip install -e .
1919
```
2020

21-
Install the GPU extra when using the SGLang-backed `llm` processor for local
22-
GPU inference:
21+
Install the GPU extra when using the SGLang-backed `llm` processor for local GPU inference:
2322

2423
```bash
25-
pip install -e './MMIRAGE[gpu]'
24+
pip install -e ".[gpu]"
2625
```
2726

2827
For testing and scripts that make use of the library, it is advised to create a .env file:
2928
```bash
3029
./scripts/generate_env.sh
3130
```
3231

33-
## Docker
32+
## Docker
3433

35-
### Build
34+
The `docker-compose.yml` defines two services, `mmirage` (GPU) and `mmirage-cpu`.
3635

37-
```bash
38-
docker compose build
39-
```
36+
### Prebuilt images
37+
38+
Prebuilt images are published to GHCR for each push to `main`:
4039

41-
### Run
40+
- `ghcr.io/epflight/mmirage:latest-gpu` (linux/amd64)
41+
- `ghcr.io/epflight/mmirage:latest-cpu` (linux/amd64, linux/arm64)
42+
43+
How to use them:
4244

4345
```bash
44-
docker compose run --rm mmirage --config configs/your_config.yaml
46+
# GPU
47+
docker pull ghcr.io/epflight/mmirage:latest-gpu
48+
docker run --rm -it --gpus all ghcr.io/epflight/mmirage:latest-gpu
49+
50+
# CPU
51+
docker pull ghcr.io/epflight/mmirage:latest-cpu
52+
docker run --rm -it ghcr.io/epflight/mmirage:latest-cpu
4553
```
4654

55+
### GPU
56+
4757
The container requires an NVIDIA GPU. The `docker-compose.yml` is configured to request GPU access, but the host must have:
4858
- NVIDIA GPU drivers installed
4959
- NVIDIA Container Toolkit / `nvidia-container-runtime` configured for Docker
5060
- A recent Docker Engine and Docker Compose version with GPU support enabled
5161

52-
Without these host-side prerequisites, `docker compose run` may fail to detect or use the GPU.
62+
Commands:
63+
64+
```bash
65+
# Build
66+
docker compose build mmirage
67+
68+
# Run
69+
docker compose run --rm -it mmirage
70+
```
5371

5472
### CPU-only
5573

56-
The CPU image installs MMIRAGE without the GPU extra. It is suitable for
57-
workflows that do not instantiate the SGLang-backed `llm` processor, and is
58-
intended to support API-backed processors once they are available. Current
59-
configs that use `type: llm` require the GPU image or an install with the
60-
`[gpu]` extra.
74+
The CPU image installs MMIRAGE without the GPU extra. It is suitable for workflows that do not instantiate the SGLang-backed `llm` processor, and is intended to support API-backed processors once they are available. No CPU-ready configuration files are provided yet.
75+
76+
Commands:
6177

6278
```bash
63-
docker compose run --rm mmirage-cpu --config configs/your_config.yaml
79+
# Build
80+
docker compose build mmirage-cpu
81+
82+
# Run
83+
docker compose run --rm -it mmirage-cpu
6484
```
6585

6686
## Key features

docker/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM lmsysorg/sglang:latest
1+
FROM lmsysorg/sglang:v0.5.3rc1-cu126
22

33
ENV NVIDIA_VISIBLE_DEVICES=all
44
ENV NVIDIA_DRIVER_CAPABILITIES=compute,utility
@@ -8,4 +8,4 @@ WORKDIR /workspace/MMIRAGE
88

99
RUN pip install --no-cache-dir .[gpu]
1010

11-
ENTRYPOINT ["python3", "-m", "mmirage.shard_process"]
11+
ENTRYPOINT ["/bin/bash"]

docker/Dockerfile.cpu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ WORKDIR /workspace/MMIRAGE
55

66
RUN pip install --no-cache-dir .
77

8-
ENTRYPOINT ["python3", "-m", "mmirage.shard_process"]
8+
ENTRYPOINT ["/bin/bash"]

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ dependencies = [
4040

4141
[project.optional-dependencies]
4242
gpu = [
43-
"sglang>=0.5.2",
43+
"sglang==0.5.10",
4444
"sgl_kernel",
4545
"xgrammar",
4646
"compressed_tensors",

0 commit comments

Comments
 (0)