From 66a0679e18fb1ab203dd2719aaa52084e303b56f Mon Sep 17 00:00:00 2001 From: JB Date: Sun, 5 Oct 2025 16:05:16 -0700 Subject: [PATCH] feat: Update Docker configuration for GPU support and remove deprecated compose file --- README.md | 18 +++++++--------- docker-compose.gpu.yml => docker-compose.yaml | 21 ++++++++++++------- 2 files changed, 20 insertions(+), 19 deletions(-) rename docker-compose.gpu.yml => docker-compose.yaml (50%) diff --git a/README.md b/README.md index d6ae13c..865a3c9 100644 --- a/README.md +++ b/README.md @@ -53,24 +53,20 @@ Browse to http://localhost:8000. Uploaded source files are stored in `/data/uplo Set any of these with `-e VAR=value` when starting the container. -### GPU-enabled build -If you want CUDA acceleration inside the container, a GPU-aware Docker runtime (for example the NVIDIA Container Toolkit) is required. The repository ships an updated `abogen/Dockerfile` based on the CUDA runtime plus a helper Compose file. +### Docker Compose (GPU by default) +The repo includes `docker-compose.yaml`, which targets GPU hosts out of the box. Install the NVIDIA Container Toolkit and run: ```bash -# Build the GPU image (installs the matching CUDA PyTorch wheel) -docker compose -f docker-compose.gpu.yml build - -# Start the service with GPU access (--profile gpu in Compose v2 is optional) -docker compose -f docker-compose.gpu.yml up -d +docker compose up -d --build ``` -Useful overrides: +Key build/runtime knobs: -- `TORCH_VERSION` – pin a specific PyTorch release that matches your host driver (leave empty for latest). -- `TORCH_INDEX_URL` – change the download index if you need a different CUDA build. +- `TORCH_VERSION` – pin a specific PyTorch release that matches your driver (leave blank for the latest on the configured index). +- `TORCH_INDEX_URL` – swap out the PyTorch download index when targeting a different CUDA build. - `ABOGEN_DATA` – host path that stores uploads/outputs (defaults to `./data`). -The Compose file reserves a GPU via `device_requests`. Standard `docker run` works as well: +CPU-only deployment: comment out the `deploy.resources.reservations.devices` block (and the optional `runtime: nvidia` line) inside the compose file. Compose will then run without requesting a GPU. If you prefer the classic CLI: ```bash docker build -f abogen/Dockerfile -t abogen-gpu . diff --git a/docker-compose.gpu.yml b/docker-compose.yaml similarity index 50% rename from docker-compose.gpu.yml rename to docker-compose.yaml index f498225..8395d21 100644 --- a/docker-compose.gpu.yml +++ b/docker-compose.yaml @@ -1,3 +1,5 @@ +version: "3.9" + services: abogen: build: @@ -6,7 +8,7 @@ services: args: TORCH_INDEX_URL: ${TORCH_INDEX_URL:-https://download.pytorch.org/whl/cu124} TORCH_VERSION: ${TORCH_VERSION:-} - image: abogen-gpu:latest + image: abogen:latest ports: - "${ABOGEN_PORT:-8000}:8000" volumes: @@ -16,15 +18,18 @@ services: ABOGEN_PORT: 8000 ABOGEN_UPLOAD_ROOT: /data/uploads ABOGEN_OUTPUT_ROOT: /data/outputs + # --- GPU support ----------------------------------------------------- + # These settings assume the NVIDIA Container Toolkit is installed. + # Leave them in place for GPU acceleration; comment out the entire block + # below if you are deploying to a CPU-only host. deploy: resources: reservations: devices: - - driver: nvidia - count: all - capabilities: [gpu] - device_requests: - - driver: nvidia - count: -1 - capabilities: [gpu] + - capabilities: [gpu] + # driver: nvidia + # count: all + # Runtime flag is only honored by legacy docker-compose (v1) CLI. + # Uncomment if you're still using it: + # runtime: nvidia restart: unless-stopped