Skip to content

Commit 76fcd2f

Browse files
committed
Update README with Docker usage instructions
1 parent 46362e6 commit 76fcd2f

File tree

1 file changed

+62
-1
lines changed

1 file changed

+62
-1
lines changed

genai-cookbook/README.md

Lines changed: 62 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ To use the cookbook with MAX:
154154
1. **Start the model server** (in a separate terminal):
155155
156156
```bash
157-
max serve --model meta-llama/Llama-3.1-8B-Instruct
157+
max serve --model google/gemma-3-27b-it
158158
```
159159
160160
For more details, see the [MAX quickstart](https://docs.modular.com/max/get-started/).
@@ -173,6 +173,67 @@ To use the cookbook with MAX:
173173
174174
3. **Select MAX** in the cookbook UI endpoint selector
175175
176+
## Running with Docker
177+
178+
The GenAI Cookbook can be run entirely within a Docker container, including the MAX model server and web application.
179+
180+
### Building the Container
181+
182+
The Dockerfile defaults to NVIDIA GPUs:
183+
184+
```bash
185+
docker build --ulimit nofile=65535:65535 -t max-recipes:latest .
186+
```
187+
188+
Use the `--build-arg` flag to specify AMD:
189+
190+
```bash
191+
docker build --build-arg GPU_TYPE=amd --ulimit nofile=65535:65535 -t max-recipes:latest .
192+
```
193+
194+
**Note:** The `--ulimit nofile=65535:65535` flag increases the file descriptor limit, which is needed for Next.js builds.
195+
196+
### Running the Container
197+
198+
#### With NVIDIA GPUs
199+
200+
```bash
201+
docker run --gpus all \
202+
-v ~/.cache/huggingface:/root/.cache/huggingface \
203+
--env "HF_HUB_ENABLE_HF_TRANSFER=1" \
204+
--env "HF_TOKEN=your-huggingface-token" \
205+
--env "MAX_MODEL=google/gemma-3-27b-it" \
206+
-p 8000:8000 \
207+
-p 3000:3000 \
208+
max-recipes:latest
209+
```
210+
211+
#### With AMD GPUs
212+
213+
```bash
214+
docker run \
215+
--group-add keep-groups \
216+
--rm \
217+
--device /dev/kfd \
218+
--device /dev/dri \
219+
-v ~/.cache/huggingface:/root/.cache/huggingface \
220+
--env "HF_HUB_ENABLE_HF_TRANSFER=1" \
221+
--env "HF_TOKEN=your-huggingface-token" \
222+
--env "MAX_MODEL=google/gemma-3-27b-it" \
223+
-p 8000:8000 \
224+
-p 3000:3000 \
225+
max-recipes:latest
226+
```
227+
228+
**Configuration:**
229+
- **Port 8000**: MAX model serving endpoint
230+
- **Port 3000**: GenAI Cookbook web application
231+
- **HF_TOKEN**: Your HuggingFace token for downloading models
232+
- **MAX_MODEL**: The model to serve (e.g., `google/gemma-3-27b-it`)
233+
- **Volume mount**: Caches downloaded models in `~/.cache/huggingface`
234+
235+
Once running, navigate to [http://localhost:3000](http://localhost:3000) to access the cookbook.
236+
176237
## Available Scripts
177238

178239
- `npm run dev` - Start development server with hot reloading

0 commit comments

Comments
 (0)