This repository contains a minimal Astro application that can be deployed on Clever Cloud. It demonstrates how to deploy a static Astro site with an interactive Preact island using Clever Cloud's static runtime.
src/pages/index.astro- Main page (static HTML)src/components/Counter.tsx- Interactive Preact island (client-side JS)src/layouts/Layout.astro- Shared HTML layoutastro.config.mjs- Astro configuration with Preact integrationpackage.json- Node.js project configuration
- Static site generation with Astro
- Interactive Preact island using Astro's
client:visibledirective - Clever Cloud brand colors and Montserrat typography
- Image optimization with Sharp (responsive WebP generation)
- Zero JavaScript on static parts of the page
- Ready for deployment on Clever Cloud's static runtime
- Node.js 22 or later
To run this application locally:
npm install
npm run devThe dev server will start on http://localhost:4321
To build and preview the production output:
npm run build
npm run previewAstro builds to static HTML, so this example uses Clever Cloud's static runtime.
-
Install the Clever Cloud CLI:
npm install -g clever-tools
-
Login to your Clever Cloud account:
clever login
-
Create a new static application:
clever create --type static-apache <app-name>
-
Set the environment variables:
clever env set CC_WEBROOT "/dist" clever env set SHARP_IGNORE_GLOBAL_LIBVIPS "1"
Clever Cloud auto-detects the Astro configuration and runs the build automatically. See Sharp image optimization on Clever Cloud for details on the
SHARP_IGNORE_GLOBAL_LIBVIPSvariable. -
Deploy your application:
clever deploy
You can also deploy directly from the Clever Cloud Console:
- Create a new application in the console
- Select Static as the runtime
- Set
CC_WEBROOTto/distin the environment variables - Clever Cloud auto-detects Astro and builds automatically
- Follow the deployment instructions provided in the console
Astro uses Sharp for image optimization. Sharp ships with its own pre-compiled binaries, but when it detects a globally installed libvips on the system, it tries to rebuild against the system library instead of using its bundled ones. On Clever Cloud instances libvips is installed globally, so Sharp attempts this rebuild — which requires node-gyp and node-addon-api, neither of which is available by default, causing the install to fail (see sharp#4498).
There are two ways to fix this:
Option A — Ignore system libvips (recommended)
Set the SHARP_IGNORE_GLOBAL_LIBVIPS environment variable so Sharp uses its own pre-compiled binary:
clever env set SHARP_IGNORE_GLOBAL_LIBVIPS "1"Option B — Provide build dependencies for native compilation
Install the missing build dependencies so Sharp can compile against the system libvips:
clever env set CC_PRE_BUILD_HOOK "npm install node-addon-api node-gyp sharp"This works reliably but adds significant time to each build.
CC_WEBROOT- Directory served by the static runtime (/dist)SHARP_IGNORE_GLOBAL_LIBVIPS- Set to1to avoid Sharp/libvips build issues (recommended)
Clever Cloud is a European cloud provider that automates the deployment and running of applications, allowing developers to focus on code rather than infrastructure.
