Add Dockerfile, docker-compose.yml, and Docker usage instructions
This commit is contained in:
+47
@@ -0,0 +1,47 @@
|
||||
# ── J-Wash Docker image ──────────────────────────────────────────────────────
|
||||
# Requires an NVIDIA GPU with CUDA 12.4+ drivers on the host.
|
||||
# docker build -t j-wash .
|
||||
# docker run --gpus all -p 8381:8381 -v ./data:/app/data -v ./hf_cache:/app/hf_cache j-wash
|
||||
|
||||
FROM nvidia/cuda:12.4.1-runtime-ubuntu22.04 AS base
|
||||
|
||||
SHELL ["/bin/bash", "-c"]
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
python3.11 python3.11-dev python3-pip python3-venv \
|
||||
git curl ca-certificates \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
|
||||
&& apt-get install -y nodejs \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN python3.11 -m venv /venv
|
||||
ENV PATH="/venv/bin:$PATH"
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY requirements.txt .
|
||||
|
||||
RUN pip install --no-cache-dir torch --index-url https://download.pytorch.org/whl/cu124
|
||||
|
||||
RUN git clone https://github.com/anthropics/jacobian-lens vendor/jacobian-lens \
|
||||
&& pip install -e vendor/jacobian-lens
|
||||
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
COPY ui/package.json ui/package-lock.json ui/
|
||||
RUN cd ui && npm ci
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN cd ui && npm run build
|
||||
|
||||
ENV HF_HOME=/app/hf_cache
|
||||
ENV JWASH_DATA_DIR=/app/data
|
||||
|
||||
EXPOSE 8381
|
||||
|
||||
VOLUME ["/app/data", "/app/hf_cache", "/app/lenses"]
|
||||
|
||||
ENTRYPOINT ["python3.11", "-X", "utf8", "run.py"]
|
||||
@@ -46,6 +46,8 @@ Requirements:
|
||||
- Python 3.11+
|
||||
- Node.js 18+
|
||||
|
||||
### Native
|
||||
|
||||
```bash
|
||||
git clone https://github.com/extraltodeus/j-wash.git
|
||||
cd j-wash
|
||||
@@ -63,6 +65,50 @@ python -X utf8 run.py
|
||||
|
||||
Then open **http://localhost:8381**.
|
||||
|
||||
### Docker
|
||||
|
||||
Requirements:
|
||||
- NVIDIA GPU with CUDA 12.4+ drivers
|
||||
- [Docker](https://docs.docker.com/engine/install/) with the [NVIDIA Container Toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html)
|
||||
|
||||
```bash
|
||||
# Build the image
|
||||
docker build -t j-wash .
|
||||
|
||||
# Run (data and HF cache persist on the host)
|
||||
docker run --gpus all \
|
||||
-p 8381:8381 \
|
||||
-v ./data:/app/data \
|
||||
-v ./hf_cache:/app/hf_cache \
|
||||
-v ./lenses:/app/lenses \
|
||||
j-wash
|
||||
```
|
||||
|
||||
Or use Docker Compose:
|
||||
|
||||
```bash
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
The container runs `python -X utf8 run.py` by default. Pass additional arguments
|
||||
(e.g. `--port`, `--data-dir`, `--hf-cache`) after the image name:
|
||||
|
||||
```bash
|
||||
docker run --gpus all -p 8381:8381 j-wash --port 8381 --data-dir /app/data --hf-cache /app/hf_cache
|
||||
```
|
||||
|
||||
Set `HF_TOKEN` for gated/private models:
|
||||
|
||||
```bash
|
||||
docker run --gpus all -p 8381:8381 -e HF_TOKEN=hf_your_token j-wash
|
||||
# or with docker-compose:
|
||||
# HF_TOKEN=hf_your_token docker compose up -d
|
||||
```
|
||||
|
||||
> **Note**: The Docker image includes the `jacobian-lens` library and pre-builds the
|
||||
> React front-end at build time. Model weights are downloaded at runtime into the
|
||||
> mounted `hf_cache` volume (shared with the host).
|
||||
|
||||
|
||||
## Running
|
||||
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
services:
|
||||
j-wash:
|
||||
build: .
|
||||
image: j-wash
|
||||
container_name: j-wash
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "8381:8381"
|
||||
volumes:
|
||||
- ./data:/app/data
|
||||
- ./hf_cache:/app/hf_cache
|
||||
- ./lenses:/app/lenses
|
||||
environment:
|
||||
- HF_HOME=/app/hf_cache
|
||||
- JWASH_DATA_DIR=/app/data
|
||||
- HF_TOKEN=${HF_TOKEN:-}
|
||||
deploy:
|
||||
resources:
|
||||
reservations:
|
||||
devices:
|
||||
- driver: nvidia
|
||||
count: all
|
||||
capabilities: [gpu]
|
||||
Reference in New Issue
Block a user