Skip to main content

Documentation Index

Fetch the complete documentation index at: https://ryvn.ai/docs/llms.txt

Use this file to discover all available pages before exploring further.

Some Docker builds need private credentials — NPM tokens for private registries, API keys for fetching assets, SSH keys for private dependencies. Ryvn’s build action makes these available to your Dockerfile through BUILD_SECRETS. This guide walks through configuring build secrets end-to-end: declaring them in your service YAML, passing them through your GitHub workflow, and consuming them in your Dockerfile.

How it works

Your service YAML declares which build args it needs using ${VAR} references. The build action resolves these from environment variables set by BUILD_SECRETS, then passes them to Docker.

Step 1: reference secrets in your service YAML

Declare the secrets your build needs as build.args with ${VAR} syntax. The build action uses envsubst to resolve these from environment variables at build time:
kind: Service
metadata:
  name: api
spec:
  type: server
  repo: acme/api
  build:
    context: .
    dockerfile: Dockerfile
    args:
      NPM_TOKEN: ${NPM_TOKEN}
      SOME_ACCESS_TOKEN: ${SOME_ACCESS_TOKEN}
You can mix literal values and variable references:
    args:
      NODE_ENV: production           # literal — always this value
      NPM_TOKEN: ${NPM_TOKEN}       # resolved from BUILD_SECRETS at build time

Step 2: add secrets to GitHub and pass them in your workflow

The BUILD_SECRETS workflow secret accepts KEY=VALUE pairs, one per line. There are two ways to set this up: The build action sets each KEY=VALUE pair as an environment variable, then envsubst resolves the ${VAR} references in your service’s build.args.

Step 3: use secrets in your Dockerfile

Common issues

Make sure the secret name in --mount=type=secret,id=NPM_TOKEN matches the key name in your BUILD_SECRETS exactly (case-sensitive). Also verify that your service YAML’s build.args has a matching ${NPM_TOKEN} reference.
Your Dockerfile is missing the # syntax=docker/dockerfile:1 directive on the first line. This directive must be the very first line — before any comments or FROM instructions.
Verify your GitHub Actions secrets are set correctly and that the key names in BUILD_SECRETS match the ${VAR} references in your service YAML’s build.args. Check for typos, extra whitespace, or quotes around values.
Any value passed as --build-arg is baked into image layers. To prevent this, switch your Dockerfile to use --mount=type=secret instead of ARG. See the Secret mounts tab for an example.