手順
1. docker-compose.yml
を作成
docker-compose.yml
services:
node:
image: node:lts-alpine
volumes:
- ./project/:/project/
working_dir: /project/
ports:
- "3000:3000"
tty: true
# command: 'npm run dev -- --host 0.0.0.0'
2. コンテナの起動 🐋
docker compose up
3. Astro のインストール
docker compose exec node npm create astro@latest .
実行後、↓ 質問があるので、
Need to install the following packages:
create-astro@1.2.3
Ok to proceed? (y) y
╭─────╮ Houston:
│ ◠ ◡ ◠ I'll be your assistant today.
╰─────╯
astro v1.6.10 Launch sequence initiated.
✔ Using . as project directory.
? How would you like to setup your new project? › - Use arrow-keys. Return to submit.
❯ a few best practices (recommended)
a personal website starter kit
an empty project✔ Using . as project directory.
✔ How would you like to setup your new project? › a few best practices (recommended)
■■▶ Copying project files...(node:79) ExperimentalWarning: The Fetch API is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
✔ Template copied!
✔ Would you like to install npm dependencies? (recommended) … yes
✔ Packages installed!
✔ Would you like to initialize a new git repository? (optional) … no
◼ Sounds good! You can come back and run git init later.
✔ How would you like to setup TypeScript? › Strict
✔ TypeScript settings applied!
next Liftoff confirmed. Explore your project!
Run npm run dev to start the dev server. CTRL+C to stop.
Add frameworks like react or tailwind using astro add.
Stuck? Join us at https://astro.build/chat
╭─────╮ Houston:
│ ◠ ◡ ◠ Good luck out there, astronaut!
╰─────╯
回答するとインストールが完了する。
4. Astro の打ち上げ 🚀
docker compose exec node npm run dev -- --host 0.0.0.0
http://localhost:3000 にアクセスする。