Launch a trial, no registration needed https://diploi.com/component/astro
Uses the official node Docker image.
Has the @astrojs/ node adapter preconfigured.
- Sign up at
https://console.diploi.com/using your GitHub account. - In your dashboard, click Create Project +
- Under Pick Components, choose Astro
If you want to expand your Astro website with other tools, like a backend framework, here you can add them. - In Pick Add-ons, select any databases or tools supported on Diploi.
- In Repository, choose Create Repository which will generate a new GitHub repo for you.
- Click Launch Stack
Prefer the full guide? Check https://diploi.com/blog/hosting_astro_apps
Supports Bun, Yarn, npm, and pnpm. The package manager is auto-detected from your lockfile (bun.lock, yarn.lock, package-lock.json, or pnpm-lock.yaml). The install and build steps always use the detected package manager.
When the component is first initialized, dependencies are installed using the detected package manager. The development server is then started with:
npm run dev -- --hostThis can be changed with the containerCommands.developmentStart field in diploi.yaml.
Builds a production-ready image. Dependencies are installed and npm run build is run during the image build, using the detected package manager. When the container starts, it runs:
npm startThis can be changed with the containerCommands.productionStart field in diploi.yaml.
Since Vite embeds environment variables during the build step, we provide two ways to manage ENV values in production builds:
- For values that are not deployment-dependent, define them in
diploi.yamlusing the static import syntax. The values are exposed to theDockerfileasARGvariables. - For values that depend on a specific deployment (such as variables imported from other components in
diploi.yaml, or configured in the Options tab), enable the runtime build option.
When runtime build is enabled (which it is by default), npm run build is executed again when the container starts. This ensures that environment variables from the running deployment are correctly applied, and that any data loaded from other components can use the internal network.
To disable runtime build, set __VITE_RUNTIME_BUILD to false in diploi.yaml:
- name: Astro
identifier: astro
package: https://github.com/diploi/component-astro#v1.0.0
env:
include:
- name: __VITE_RUNTIME_BUILD
value: false