Astro サイトを Docker でデプロイする

静的サイトをコンテナで配信する

Astro の npm run build で生成した dist/ を、軽量な nginx イメージに載せて配信します。

Dockerfile

FROM nginx:alpine
COPY dist/ /usr/share/nginx/html

ビルドと起動

npm run build
docker build -t my-blog .
docker run -p 8080:80 my-blog

http://localhost:8080 で配信されます。あとはこのイメージを任意のホスティングへ。