How the builds are packaged: one image, hardened containers, and configuration kept out of the image.
01 · One image, two modes
The same code, a different capability.
ReviewLens ships one Docker image that runs in two modes behind a reverse proxy. The public demo is pre-analysed and its container never receives the API key. The live site, which can call the model, sits behind a password.
LaunchScout follows the same idea and fails closed: unless live mode is set explicitly, research, model access, search, scraping and deck generation are disabled where they would start, and the Docker image is demo-only and contains no credentials.
02 · Hardened by default
Small containers with little power.
The ReviewLens containers are read-only and run as a non-root user. Nothing in the image needs to write to its own filesystem, so it cannot.
- ImageOne image per app, built from a requirements file.
- ComposeDescribes the services, their environment and how the proxy reaches them.
- ConfigurationEnvironment variables and an environment file on the server, never baked into the image.
- SecretsOnly the container that needs a key receives it.
03 · Why it matters for AI apps
A key in an image is a key in the wild.
AI apps hold paid API keys, so the packaging is a safety control as much as a convenience. Putting configuration outside the image and giving each container only what it needs keeps a public demo from being able to spend or leak a key.
The public demo should be unable to spend a key, by construction.
04 · Use it yourself
A packaging checklist for an AI app.
- Keep secrets outList .env, keys and the .git folder in .dockerignore so they never enter the build.
- Run as a normal userAdd a non-root user and switch to it. A compromised app then has little power.
- Read-only where possibleRun the container with a read-only filesystem and give it a temporary folder only if it needs one.
- Pin versionsPin the base image and the dependencies, so a rebuild next month gives the same app.
- Add a health checkLet the platform know whether the app is actually working, not merely running.
- Log to the consoleWrite logs to standard output, and let the platform collect them.
05 · Secrets
Where a key may and may not live.
- Never in the imageAnything copied or passed as a build argument can be read from the image’s history.
- Never in the repositoryA key committed once should be treated as leaked, even if it is deleted later.
- At run time, on the serverSupply keys through an environment file or the platform’s secret store, readable only by the account that runs the app.
- One key per purposeUse separate keys for testing and for the public app, each with a spending limit.
- Rotate on suspicionIf a key may have been seen, replace it. It costs minutes; a leak can cost far more.
What I took away
- Keep configuration and secrets out of the image.
- Give each container only the credentials it needs.
- Make the public mode fail closed.