Build
apipod --build packages your service into a production Docker image — CUDA detection, layer caching, and custom Dockerfile support.
socaity deploy CLI that mirrors apipod commands. Today, apipod --build is the live command for packaging a service. Run from your project root. APIPod scans requirements.txt for GPU packages (torch, tensorflow, jax) and selects the correct CUDA base image automatically.
apipod --buildScanning requirements.txt... torch==2.3.0 detected
Recommended Base Image: runpod/pytorch:2.4.0-py3.11-cuda12.4.1-devel-ubuntu22.04
Is this correct? [Y/n] y
Generating Dockerfile...
Dockerfile created at apipod-deploy/Dockerfile
Build the application now using docker? (Tag: my-service) [Y/n] y
Running: docker build -t my-service -f apipod-deploy/Dockerfile .
...
Successfully built sha256:a1b2c3d4
Tagged as: my-service:latest| Flag | Default | Description |
|---|---|---|
[FILE] | | Optional target Python file (e.g. apipod --build ./main.py). |
--orchestrator | local | Orchestration platform: local (default) or socaity. |
--compute | dedicated | Compute type: dedicated (default) or serverless. |
--provider | localhost | Infrastructure provider: localhost (default), auto, runpod, scaleway, azure. |
--region | | Deployment region (optional). |
APIPod reads your requirements.txt and apipod.json to pick the optimal base image. The selection table below shows the mapping logic.
| Detected Package | CUDA Version | Base Image | Size |
|---|---|---|---|
torch (any) | 12.4 | runpod/pytorch:2.4.0-py3.11-cuda12.4.1-devel-ubuntu22.04 | ~8 GB |
tensorflow / onnx | 12.1 | nvidia/cuda:12.1.1-cudnn8-runtime-ubuntu22.04 | ~5 GB |
cuda (generic) | 12.1 | nvidia/cuda:12.1.1-cudnn8-runtime-ubuntu22.04 | ~5 GB |
none detected | CPU | python:3.10-slim | ~150 MB |
base_image in apipod.json. This is required when you need a specific CUDA patch version for driver compatibility. APIPod generates a multi-stage Dockerfile optimised for layer caching. System packages and Python dependencies are installed in separate cached layers so rebuilds only copy your changed code.
# Stage 1 — deps (cached)
FROM runpod/pytorch:2.4.0-py3.11-cuda12.4.1-devel-ubuntu22.04 AS deps
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Stage 2 — app (rebuilt on source change)
FROM deps AS app
COPY . .
EXPOSE 8080
CMD ["python", "service.py"] Drop a Dockerfile in your project root and APIPod will use it as-is instead of generating one. Keep these rules for correct operation:
- Copy your source into
/app. - Set
WORKDIR /app. - Expose port
8080. - Use
CMD ["python", "service.py"]or an equivalent entrypoint.
FROM runpod/pytorch:2.4.0-py3.11-cuda12.4.1-devel-ubuntu22.04
# Install OS-level dependencies
RUN apt-get update && apt-get install -y ffmpeg && rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
EXPOSE 8080
CMD ["python", "service.py"]{
"project": {
"name": "my-service",
"version": "1.0.0"
},
"build": {
"base_image": ""
},
"runtime": {
"gpu": "A100",
"memory_gb": 24
},
"queue": {
"max_workers": 1,
"queue_size": 500,
"job_ttl": 3600
}
}