Skip to content

Astro

Astro is a modern static site builder focused on shipping minimal JavaScript to the browser. Choose this component when you are delivering content-heavy marketing sites, blogs, or documentation that benefit from fast page loads. Diploi handles the SSR build pipeline and pushes assets where they need to run.

Paste this entry into the components list in diploi.yaml to add Astro to your project.

components:
- name: Astro
identifier: astro
package: https://github.com/diploi/component-astro#v7.1.1

Launch a trial, no registration needed https://diploi.com/component/astro

Uses the official node Docker image.

Has the @astrojs/ node adapter preconfigured.

  1. Sign up at https://console.diploi.com/ using your GitHub account.
  2. In your dashboard, click Create Project +
  3. 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.
  4. In Pick Add-ons, select any databases or tools supported on Diploi.
  5. In Repository, choose Create Repository which will generate a new GitHub repo for you.
  6. 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:

Terminal window
npm run dev -- --host

This 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:

Terminal window
npm start

This 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:

  1. For values that are not deployment-dependent, define them in diploi.yaml using the static import syntax. The values are exposed to the Dockerfile as ARG variables.
  2. 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