Getting Started with Previewops
Previewops automatically deploys pull-request previews to your cloud account. Comment /deploy-previewops on any PR and the bot builds your Docker image, deploys it, and replies with the live URL — all within minutes.
How it works
- You (or a teammate) comment
/deploy-previewopson a pull request. - Previewops builds a Docker image from the PR branch (via Cloud Build, SSH, or your provider's native build, depending on configuration).
- The image is deployed to your chosen cloud provider (Cloud Run, Fly.io, AWS Lightsail, etc.).
- Previewops posts a comment on the PR with the preview URL.
- When the PR is merged or closed, Previewops deletes the preview automatically.
- Previews also expire automatically after their TTL (default: 24 hours).
Prerequisites
GitHub App installed on your organisation or repository. Install Previewops →
Cloud credentials stored (required for Free and Premium BYOC plans). See credentials.md.
Free BYOC: only public repositories are supported. Private repo support requires Premium BYOC.
A Dockerfile in your repository root (or configured via
.previewops.yaml). If your Dockerfile is not in the repo root, you will need to set the path in.previewops.yamlbefore your first deploy.Previewops builds and runs your container as-is. A few requirements:
- The container must listen on a port (Previewops detects it automatically, or you can pin it via
port:in.previewops.yaml). - The container must start quickly — Previewops polls for readiness after deploy; a slow cold start will delay the preview URL appearing on the PR.
- Run as a non-root user where possible (required by some providers, e.g. Cloud Run).
A minimal production-ready multi-stage Dockerfile looks like this:
# ── Build stage ────────────────────────────────────────────────────────── FROM node:22-alpine AS builder WORKDIR /app COPY package*.json ./ RUN npm ci COPY . . RUN npm run build # ── Runtime stage ──────────────────────────────────────────────────────── FROM node:22-alpine AS runtime # Non-root user (required by Cloud Run; best practice everywhere) RUN addgroup -S app && adduser -S app -G app WORKDIR /app COPY --from=builder /app/dist ./dist COPY --from=builder /app/node_modules ./node_modules COPY package.json ./ USER app ENV NODE_ENV=production ENV PORT=8080 EXPOSE 8080 CMD ["node", "dist/index.js"]Adjust the build commands, copied paths, and base image for your language/framework. For non-Node stacks (Python, Go, Ruby, etc.) the same multi-stage pattern applies — compile/install in a builder stage, copy only the artefacts into a slim runtime image.
- The container must listen on a port (Previewops detects it automatically, or you can pin it via
Your first deploy
Step 1 — Install the GitHub App
Go to the Previewops GitHub App page and install it on your organisation or the specific repositories you want to enable.
After installation, sign in to the dashboard with GitHub. If you belong to multiple organisations that have Previewops installed, you'll be prompted to choose which org's dashboard to access.
Step 2 — Store your cloud credentials (BYOC plans)
If you are on the Free or Premium BYOC plan, you need to add your cloud provider credentials before your first deploy. Click Credentials in the left sidebar, or see credentials.md for a step-by-step walkthrough.
Pro, Enterprise, and Custom plan users can skip this step — Previewops handles the cloud account for you.
Step 3 — Open a pull request and deploy
Comment on any open PR in an enabled repository:
/deploy-previewops
Previewops will reply with a "Building Previewops environment…" comment on the PR, then update it with the live preview URL once the deploy completes (typically 2–5 minutes depending on build time).
Deploy status guide:
- ✅ Live — the service deployed successfully. If the preview URL doesn't respond immediately, the app may still be starting up — wait 30–60 seconds and refresh.
- ❌ Failed — a credential or configuration problem stopped the deploy. Expand the Show build logs section in the PR comment to see the error, or use the included Ask Claude / Ask ChatGPT / Open in Cursor links to get AI-assisted debugging help. Run
/validate-previewopsto check your credentials and configuration.- ✅ Live (app may still be starting) — the service deployed successfully but didn't respond to a health check in time. The preview URL is usable — try it directly.
Step 4 — Configure per-repo settings (required if Dockerfile is not in root)
Add a .previewops.yaml file to the root of your repository to customise TTL, concurrency, the Dockerfile path, and more. See configuration.md for all available options.
Next steps
- welcome.md — Overview, plans, and full table of contents
- commands.md — Full command reference (
/deploy-previewops,/delete-previewops,/list-previewops,/validate-previewops,/qa-previewops,/perf-previewops) - qa-testing.md — AI code review, test coverage mapping, and HTTP smoke tests with
/qa-previewops - qa-hub.md — Dashboard-based Playwright test library and runs against preview URLs (Pro / Enterprise / Custom)
- performance-testing.md — Run k6 load tests against your preview with
/perf-previewops - add-ons.md — Optional add-ons: Advanced Perf (longer tests, baselines) and Custom LLM (BYOC LLM key)
- configuration.md —
.previewops.yamlschema and runtime options - databases.md — Connecting a database to your preview container, credential safety, and migrations
- authentication.md — JWT, OAuth, session cookies, and HTTPS in preview environments
- credentials.md — How to add and manage cloud credentials
- plans.md — Plan comparison, caps, AI QA features, and how to upgrade
- providers/ — Per-provider setup guides
- self-hosting.md — Run your own Previewops instance