Skip to content

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.

For static sites served from a Cloud Storage bucket, add pageflare to your cloudbuild.yaml:

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'

For Cloud Run, use a multi-stage Dockerfile:

Dockerfile
FROM node:22-slim AS build
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build && npx @pageflare/cli dist/ --in-place --no-progress
FROM nginx:alpine
COPY --from=build /app/dist /usr/share/nginx/html
EXPOSE 8080
CMD ["nginx", "-g", "daemon off;"]

Deploy with:

Terminal window
gcloud run deploy my-site --source .

Add pageflare to the build script in package.json:

package.json
{
"scripts": {
"build": "astro build && npx @pageflare/cli dist/ --in-place --no-progress"
}
}
app.yaml
runtime: nodejs22
handlers:
- url: /
static_dir: dist

Store your license key in Secret Manager:

Terminal window
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.

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 errors
FrameworkOutput directory
Astrodist/
Next.js static exportout/
Hugopublic/
Vitedist/
Eleventy_site/

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.