Skip to content

Build

socaity build turns your project into a Docker image. APIPod scans the code for framework hints, picks a base image from the catalog, prompts you to accept the choice, generates a Dockerfile, and (optionally) runs docker build.

socaity scan

The scanner walks your project and writes a single config file at apipod-deploy/apipod.json. It records the entrypoint (defaults to main.py), the Python version (defaults to 3.10), framework signals (PyTorch, TensorFlow, ONNX, transformers, diffusers, CUDA), required system packages, model files on disk, and whether a .env file is present.

terminal
socaity scan
# writes apipod-deploy/apipod.json

socaity build

Run from the project root. socaity build reuses the existing apipod-deploy/apipod.json if you already scanned, otherwise it scans first. It then proposes a base image, asks you to confirm, writes apipod-deploy/Dockerfile, and offers to invoke docker build -t apipod-<title>.

terminal
socaity build
# or target a specific entrypoint:
socaity build ./service.py
terminal
Scanning project... torch detected, python_version=3.10
Recommended base image: runpod/pytorch:2.4.0-py3.11-cuda12.4.1-devel-ubuntu22.04
Is this correct? [Y/n] y
Generating Dockerfile at apipod-deploy/Dockerfile...
Build the application now using docker? (Tag: apipod-my-service) [Y/n] y
Running: docker build -t apipod-my-service -f apipod-deploy/Dockerfile .
...
Successfully built sha256:a1b2c3d4
Tagged as: apipod-my-service:latest

Build flags

The CLI takes an optional FILE argument on socaity build to override the detected entrypoint, plus deployment flags such as --provider and --compute.

FlagDefaultDescription
[FILE]main.pyOptional Python entrypoint. Overrides the detected file.
--orchestratorlocallocal or socaity. Baked into the image as APIPOD_ORCHESTRATOR.
--computededicateddedicated or serverless. Baked as APIPOD_COMPUTE.
--providerlocalhostauto, localhost, runpod, scaleway, azure. Baked as APIPOD_PROVIDER. scaleway and azure raise NotImplementedError today.
--regionNoneAccepted and written to the deploy config, but not yet applied. Region is platform-selected today (roadmap).

Base image selection

The catalog at apipod/deploy/docker_images.txt holds 23 base images: python:3.7-slim through python:3.14-slim and 14 runpod/pytorch variants spanning CUDA 12.1, 12.8, 12.9, 13.0 and PyTorch 2.60, 2.71, 2.80 on Ubuntu 22.04 or 24.04. The recommender picks from this list using the rules below.

Detected signalRecommendation
PyTorch or CUDA detectedrunpod/pytorch:* from docker_images.txt (fallback: runpod/pytorch:2.4.0-py3.11-cuda12.4.1-devel-ubuntu22.04)
TensorFlow or ONNX, no PyTorchnvidia/cuda:12.1.1-cudnn8-runtime-ubuntu22.04
No GPU framework detectedpython:{python_version}-slim (default python:3.10-slim)

Generated Dockerfile

APIPod renders apipod-deploy/Dockerfile from a Jinja template. The file installs system packages (always ffmpeg, gcc, g++, curl, ca-certificates), installs your requirements, installs runpod>=1.7.7, bakes the orchestrator/compute/provider env vars, exposes port 8000, and starts uvicorn on 0.0.0.0:8000.

apipod-deploy/Dockerfile
FROM runpod/pytorch:2.4.0-py3.11-cuda12.4.1-devel-ubuntu22.04

# Always installed. ffmpeg covers media I/O, gcc/g++ cover native wheels.
RUN apt-get update && apt-get install -y --no-install-recommends \
    ffmpeg gcc g++ curl ca-certificates python3-pip python3-dev \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /app
COPY . /app

RUN pip install --upgrade pip
RUN pip install -r requirements.txt
# runpod>=1.7.7 is always installed, regardless of provider.
RUN pip install runpod>=1.7.7
RUN pip install .

ENV APIPOD_ORCHESTRATOR=local
ENV APIPOD_COMPUTE=dedicated
ENV APIPOD_PROVIDER=localhost
ENV APIPOD_HOST=0.0.0.0
ENV APIPOD_PORT=8000

EXPOSE 8000
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]

Custom Dockerfile

Drop a Dockerfile in your project root and APIPod uses it as-is instead of generating one. Match these conventions so the rest of the platform still works:

  • Expose port 8000 and bind uvicorn to 0.0.0.0.
  • Start the service with uvicorn {entrypoint}:app --host 0.0.0.0 --port 8000.
  • Install runpod>=1.7.7 regardless of provider. APIPod imports it at runtime.
  • Set the APIPOD_* env vars (orchestrator, compute, provider, host, port) or pass them in at run time.
Dockerfile (custom)
FROM runpod/pytorch:2.4.0-py3.11-cuda12.4.1-devel-ubuntu22.04

RUN apt-get update && apt-get install -y ffmpeg gcc g++ \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
RUN pip install runpod>=1.7.7

COPY . .

ENV APIPOD_HOST=0.0.0.0
ENV APIPOD_PORT=8000

EXPOSE 8000
CMD ["uvicorn", "service:app", "--host", "0.0.0.0", "--port", "8000"]

apipod.json

The scanner writes the file below. Edit it between socaity scan and socaity build to override the entrypoint, pin a Python version, or force a specific base image.

apipod-deploy/apipod.json
{
  "project": {
    "name": "my-service",
    "entrypoint": "main.py"
  },
  "python": {
    "version": "3.10"
  },
  "frameworks": {
    "pytorch": true,
    "tensorflow": false,
    "onnx": false,
    "transformers": true,
    "diffusers": false,
    "cuda": true
  },
  "system_packages": ["ffmpeg"],
  "model_files": [],
  "env_file": true,
  "base_image": ""
}