Deploy your Astro Site to Juno
Ce contenu n’est pas encore disponible dans votre langue.
Juno is an open-source serverless platform for hosting static websites, building web applications, and running serverless functions with the privacy and control of self-hosting.
Create your container
Section titled “Create your container”-
Log in to the Juno Console.
-
Click the Launch a new satellite button (the container for your project) from the launchpad
-
Enter a name and select Website
-
Confirm with Create a Satellite
-
The platform will then provision its resources.
-
Once the process is complete, click Continue to access the overview page.
Configure your project
Section titled “Configure your project”Your Astro project can be deployed to Juno as a static site.
Create a juno.config.mjs file at the root of your project, and replace the PROD_SATELLITE_ID with the ID of the Satellite you created earlier.
import { defineConfig } from '@junobuild/config';
/** @type {import('@junobuild/config').JunoConfig} */export default defineConfig({ satellite: { ids: { production: '<PROD_SATELLITE_ID>' }, source: 'dist', predeploy: ['npm run build'] }});How to deploy
Section titled “How to deploy”You can deploy using either GitHub Actions or CLI (command line interface).
GitHub Actions deployment
Section titled “GitHub Actions deployment”-
From your Satellite’s overview, navigate to the Setup tab.
-
Click on Add an access key.
-
Generate a new key with the default option. Click Submit.
-
Upon successful creation, a Secret token will be displayed. Copy the value and save it as an encrypted secret in your GitHub repository or organization, using the key
JUNO_TOKEN. -
Create a
deploy.ymlfile in the.github/workflowssubfolder of your repo. -
Add the following workflow configuration:
.github/workflows/deploy.yml name: Deploy to Junoon:workflow_dispatch:push:branches: [main]jobs:deploy:runs-on: ubuntu-lateststeps:- name: Check out the repouses: actions/checkout@v4- uses: actions/setup-node@v4with:node-version: 24registry-url: "https://registry.npmjs.org"- name: Install Dependenciesrun: npm ci- name: Deploy to Junouses: junobuild/juno-action@mainwith:args: hosting deployenv:JUNO_TOKEN: ${{ secrets.JUNO_TOKEN }}
CLI deployment
Section titled “CLI deployment”-
Install the CLI
Terminal window npm i -g @junobuild/cliTerminal window pnpm add -g @junobuild/cliTerminal window yarn global add @junobuild/cli -
Authenticate the CLI. This will open the Juno Console.
Terminal window juno loginAn access token is used to identify your terminal. That’s why the CLI asks whether you want to encrypt it with a password. For security reasons, it’s recommended that you do so.
-
In the browser window, click Authorize to grant permission.
-
Deploy your site:
Terminal window juno hosting deploy
Guides
Section titled “Guides”Examples
Section titled “Examples”Quickly scaffold a website with a ready-made Astro template.
npm create juno@latest -- --template astro-starterpnpm create juno -- --template astro-starteryarn create juno -- --template astro-starter