SKILL.md
SKILL.mdBrowse 1970 files
2,201 tokens
9,608 bytes
Token encoding: o200k_base
Snapshot 21a254f
1---2name: railpack3description: >-4 Configure and troubleshoot Railpack builds, with emphasis on RAILPACK_*5 environment variables, railpack.json overlays, build-plan inspection, local6 CLI installation and usage, and local BuildKit containers. Use for Railpack7 provider configuration, custom install/build/start commands, Mise or Apt8 packages, build or runtime variables and secrets, generated-plan debugging,9 BUILDKIT_HOST errors, or running Railpack from a release or source checkout.10---11 12# Railpack13 14Customize the generated BuildKit LLB without introducing a Dockerfile. Do not15propose a Dockerfile as the solution to a Railpack configuration problem.16 17## Use current sources18 19Fetch <https://railpack.com/llms.txt> as the documentation index before relying20on Railpack behavior. Open only the pages relevant to the task. Search21<https://railpack.com/llms-full.txt> when the answer spans several sections.22 23Prioritize:24 25- Environment Variables plus the detected language's page for `RAILPACK_*`.26- Configuration File for `railpack.json` fields and merge behavior.27- Secrets and Environment Variables for build-time versus runtime values.28- CLI Reference, Installation, and Getting Started for local commands.29 30When working in a Railpack source checkout, also inspect its instructions,31`mise.toml`, current documentation source, and CLI implementation. The checkout32may be ahead of the published docs. Verify flags with `railpack --help` or the33checkout's CLI task. Link the relevant public docs in user-facing guidance.34 35## Follow the configuration workflow36 371. Inspect the application manifests, lockfiles, version files, start scripts,38 existing `railpack.json`, and deployment configuration. Do not expose secret39 values while inspecting the environment.402. Generate a baseline plan before changing configuration when the CLI is41 available:42 43 ```sh44 railpack info .45 railpack plan .46 ```47 483. Use a documented `RAILPACK_*` variable for a simple supported override. Use49 `railpack.json` for structured changes, additions to generated arrays,50 custom steps, layers, caches, variables, or secrets.514. Generate the plan again and compare the relevant steps, deploy inputs,52 packages, variables, and start command.535. Run a BuildKit build only when execution is part of the request.54 55Prefer the smallest targeted override. Do not set the same option through CLI56flags, environment variables, and `railpack.json`; mixed configuration obscures57which value wins.58 59## Configure with `RAILPACK_*`60 61Confirm every name and value format in the shared environment-variable page or62the relevant language page. Common build-plan variables include:63 64- `RAILPACK_INSTALL_CMD`65- `RAILPACK_BUILD_CMD`66- `RAILPACK_START_CMD`67- `RAILPACK_PACKAGES`68- `RAILPACK_BUILD_APT_PACKAGES`69- `RAILPACK_DEPLOY_APT_PACKAGES`70- `RAILPACK_DISABLE_CACHES`71- `RAILPACK_CONFIG_FILE`72 73Treat this list as a routing aid, not a complete reference. Provider-specific74variables control language versions, package managers, framework selection, and75provider features.76 77Understand replacement semantics:78 79- `RAILPACK_INSTALL_CMD` and `RAILPACK_BUILD_CMD` replace provider-generated80 command lists; they do not append.81- `RAILPACK_START_CMD` replaces the detected start command.82- Use `railpack.json` with `"..."` when adding a command while retaining83 generated commands.84 85Use space-separated values for variables documented as lists. Include `...`86when adding Apt packages without replacing Railpack's generated packages:87 88```sh89RAILPACK_PACKAGES="node@22 jq@latest"90RAILPACK_BUILD_APT_PACKAGES="... build-essential libssl-dev"91RAILPACK_DEPLOY_APT_PACKAGES="... ffmpeg"92```93 94For local `plan`, `info`, and `build` commands, pass build-plan variables95through `--env`. The CLI does not automatically import arbitrary exported96variables:97 98```sh99railpack plan \100 --env 'RAILPACK_PACKAGES=node@22 jq@latest' \101 --env 'RAILPACK_START_CMD=node dist/server.js' \102 .103 104export RAILPACK_NODE_VERSION=22105railpack build --env RAILPACK_NODE_VERSION .106```107 108Prefer name-only `--env SECRET_NAME` after exporting a secret so its value is109not placed in the command arguments. Treat values supplied through `--env` as110build-time secrets, not runtime configuration.111 112Set non-secret build-step values in `steps.<name>.variables`. Set values that113must be baked into the final image in `deploy.variables`; prefer the hosting114platform's runtime environment for environment-specific values. Never put115secret values in `railpack.json`.116 117Treat `RAILPACK_VERBOSE` separately: it is a process-level CLI option. Use118`RAILPACK_VERBOSE=1 railpack build ...` or `railpack --verbose build ...`, not119`--env RAILPACK_VERBOSE=1`.120 121## Construct `railpack.json` as an overlay122 123Place `railpack.json` at the build-context root. For another project-relative124path, prefer `--config-file path/to/config.json`; when using125`RAILPACK_CONFIG_FILE` with the local CLI, pass it through `--env`.126 127Always include the schema:128 129```json130{131 "$schema": "https://schema.railpack.com"132}133```134 135Write the smallest overlay on the provider-generated plan. Do not copy the136entire generated plan into the config file. Use `"..."` at the desired position137in a configurable array to retain generated values; omitting it replaces that138array.139 140```json141{142 "$schema": "https://schema.railpack.com",143 "packages": {144 "node": "22"145 },146 "buildAptPackages": ["...", "build-essential"],147 "steps": {148 "build": {149 "commands": ["...", "npm run postbuild"]150 }151 },152 "deploy": {153 "aptPackages": ["...", "ffmpeg"],154 "startCommand": "node dist/server.js"155 }156}157```158 159Use the documented model:160 161- Set `provider` only to override failed or ambiguous autodetection.162- Set `packages` for Mise-managed tools and versions.163- Set root `buildAptPackages` for build-only Apt packages.164- Set `steps.<name>` for inputs, commands, caches, variables, assets, secrets,165 and deploy outputs.166- Set `deploy` for runtime base, inputs, Apt packages, paths, variables, and167 start command.168- Filter layer inputs with `include` and `exclude` when only selected artifacts169 should enter another step or the runtime image.170 171Validate names and shapes against <https://schema.railpack.com>. Use plan172generation as the semantic validation:173 174```sh175railpack plan --out tmp/railpack-plan.json .176railpack info --format json --out tmp/railpack-info.json .177```178 179Inspect the generated output for accidental replacement of commands, Apt180packages, inputs, paths, caches, or secrets. Keep generated plan files separate181from the source `railpack.json` overlay.182 183## Install and run locally184 185Check for an existing binary first:186 187```sh188command -v railpack189railpack --version190railpack --help191```192 193If installation is requested, choose a current documented method. With Mise:194 195```sh196mise use github:railwayapp/railpack@latest197railpack --help198```199 200Or use the official release installer:201 202```sh203curl -sSL https://railpack.com/install.sh | sh204railpack --help205```206 207Pin the Railpack version when reproducibility matters. Consult the Installation208page for current version and destination controls instead of inventing flags.209 210Inside the Railpack repository, follow its checked-in instructions and211`mise.toml`. Prefer its development task over an installed release:212 213```sh214mise install215mise run setup216mise run cli -- --help217```218 219Use `railpack plan` or `mise run cli -- plan` without BuildKit. Use220`railpack build` for a normal local image build; reserve `prepare` and the221BuildKit frontend workflow for platform integrations.222 223## Run a local BuildKit container224 225Require a working Docker engine with Linux containers. Starting a privileged226container changes local Docker state; do it only when a local build is within227scope.228 229Inspect any existing container named `buildkit` before reusing the name. Reuse230or start an appropriate existing daemon, or choose another name and use the same231name in `BUILDKIT_HOST`. Do not remove an unknown container to resolve a name232collision.233 234For a disposable local daemon:235 236```sh237docker run --rm --privileged --detach \238 --name buildkit \239 moby/buildkit:latest240 241docker exec buildkit buildctl debug workers242```243 244Pass `BUILDKIT_HOST` in the same shell invocation as the build. This also works245when command executions do not share exported shell state:246 247```sh248BUILDKIT_HOST='docker-container://buildkit' \249 railpack build \250 --name my-app \251 --show-plan \252 --progress plain \253 ./path/to/project254```255 256The URI's final component must match the container name. Pin the BuildKit image257for reproducible environments. If the source checkout provides258`mise run setup`, prefer that task because it may mount repository-specific259BuildKit configuration and set `BUILDKIT_HOST`.260 261Use `docker logs buildkit` for daemon or connection failures. Stop the container262only if it was created for the task; `docker stop buildkit` also removes this263disposable `--rm` container.264 265## Troubleshoot in order266 2671. Verify the installed or development CLI and relevant subcommand help.2682. Generate a plan without BuildKit and resolve detection or config errors.2693. Verify every `RAILPACK_*` variable, its list format, and whether it replaces270 generated behavior.2714. Verify every modified array retains `"..."` unless replacement is intended.2725. Confirm Docker is reachable, the BuildKit worker is ready, and273 `BUILDKIT_HOST` names the correct container.2746. Re-run with `railpack --verbose build`, `--show-plan`, and plain progress.2757. Inspect BuildKit logs and Docker credentials for private images.276 277Identify the failing layer before broadening configuration. Explain the cause278and keep the fix targeted.279 Discovery context
Discovered by repository scan. No exact path reference found in the snapshot’s root CLAUDE.md.