Publish

Build and push Docker images with workspace-aware builds.

Usage

Build Docker images and push them to a container registry. In a monorepo, specify a package name to publish a single workspace; omit it to publish all publishable packages.

bash
riven publish [package] [options]

Options

OptionDescription
--registry <url>Docker registry URL (overrides ECR_REGISTRY env var)
--tag <tag>Image tag (overrides IMAGE_TAG env var)
--platform <platform>Target platform (e.g. linux/amd64,linux/arm64)
--no-cacheBuild without Docker cache
--dry-runShow what would be published without building

Workspace Awareness

The publish command automatically detects monorepo workspaces. When run from the root of a monorepo, it discovers all packages with a Dockerfile and builds them. The package argument matches against both the workspace name (from package.json) and the directory name.

Use --dry-run to preview which packages would be built and what image tags would be generated without actually building anything.

Monorepo Example

Given a monorepo with multiple services:

text
my-monorepo/
├── packages/
│   ├── user-service/
│   │   ├── Dockerfile
│   │   └── package.json    # name: "@myorg/user-service"
│   ├── billing-service/
│   │   ├── Dockerfile
│   │   └── package.json    # name: "@myorg/billing-service"
│   └── shared-lib/
│       └── package.json    # no Dockerfile — skipped
└── package.json
bash
# Publish all services (discovers user-service and billing-service)
riven publish
 
# Publish only user-service (matches by directory or package name)
riven publish user-service
 
# Preview what would be built
riven publish --dry-run

Image Tag Format

Image tags should follow the <semver>-<short-sha> format:

bash
# The CLI reads version from package.json and appends the git short SHA
# Result: 0.1.69-de54b1c
riven publish user-service \
  --registry <account-id>.dkr.ecr.us-east-1.amazonaws.com \
  --tag "$(node -p 'require("./package.json").version')-$(git rev-parse --short HEAD)"

Examples

bash
# Publish all packages in the workspace
riven publish
 
# Publish a specific package
riven publish user-service
 
# Custom registry and tag
riven publish user-service \
  --registry 123456.dkr.ecr.us-east-1.amazonaws.com \
  --tag v1.2.3
 
# Multi-platform build
riven publish --platform linux/amd64,linux/arm64
 
# Preview without building
riven publish --dry-run

Environment Variables

VariableDescription
ECR_REGISTRYDefault Docker registry URL
IMAGE_TAGDefault image tag