Google Cloud
Google Cloud offers several hosting options for static sites — App Engine, Cloud Run, and Cloud Storage. pageflare integrates into whichever build pipeline you use.
Option 1: Cloud Build + Cloud Storage
Section titled “Option 1: Cloud Build + Cloud Storage”For static sites served from a Cloud Storage bucket, add pageflare to your cloudbuild.yaml:
steps: - name: 'node:22' entrypoint: 'bash' args: - '-c' - | npm ci npm run build npx @pageflare/cli dist/ --in-place --no-progress secretEnv: ['PAGEFLARE_LICENSE']
- name: 'gcr.io/cloud-builders/gsutil' args: ['-m', 'rsync', '-r', '-d', 'dist/', 'gs://my-bucket/']
availableSecrets: secretManager: - versionName: projects/$PROJECT_ID/secrets/PAGEFLARE_LICENSE/versions/latest env: 'PAGEFLARE_LICENSE'Option 2: Cloud Run (Dockerfile)
Section titled “Option 2: Cloud Run (Dockerfile)”For Cloud Run, use a multi-stage Dockerfile:
FROM node:22-slim AS buildWORKDIR /appCOPY package*.json ./RUN npm ciCOPY . .RUN npm run build && npx @pageflare/cli dist/ --in-place --no-progress
FROM nginx:alpineCOPY --from=build /app/dist /usr/share/nginx/htmlEXPOSE 8080CMD ["nginx", "-g", "daemon off;"]Deploy with:
gcloud run deploy my-site --source .Option 3: App Engine
Section titled “Option 3: App Engine”Add pageflare to the build script in package.json:
{ "scripts": { "build": "astro build && npx @pageflare/cli dist/ --in-place --no-progress" }}runtime: nodejs22handlers: - url: / static_dir: distPro License
Section titled “Pro License”Store your license key in Secret Manager:
echo -n "your-license-key" | gcloud secrets create PAGEFLARE_LICENSE --data-file=-Reference it in Cloud Build (shown above) or set it as an environment variable in Cloud Run.
Verify
Section titled “Verify”Check the build logs in Cloud Console for the pageflare summary:
Done 145.2 KB saved (38.1%) 1.2s Files 42 total, 38 optimized, 4 unchanged, 0 errorsFramework Output Directories
Section titled “Framework Output Directories”| Framework | Output directory |
|---|---|
| Astro | dist/ |
| Next.js static export | out/ |
| Hugo | public/ |
| Vite | dist/ |
| Eleventy | _site/ |
Troubleshooting
Section titled “Troubleshooting”Cloud Build fails with “command not found”
Make sure you use the node:22 builder image. The npx command requires Node.js.
App Engine serves unoptimized files
Verify the static_dir in app.yaml matches the directory pageflare optimized.