배포
girok-md는 GitHub Pages, Vercel, Netlify 또는 모든 정적 호스팅 플랫폼에 배포할 수 있습니다.
GitHub Pages (권장)
-
워크플로우 파일 생성
.github/workflows/deploy.yml생성:.github/workflows/deploy.yml name: Deploy to GitHub Pageson:push:branches: [main]workflow_dispatch:permissions:contents: readpages: writeid-token: writeconcurrency:group: pagescancel-in-progress: falsejobs:build:runs-on: ubuntu-lateststeps:- name: Checkoutuses: actions/checkout@v4- name: Setup Nodeuses: actions/setup-node@v4with:node-version: 20cache: npm- name: Install dependenciesrun: npm ci- name: Buildrun: npm run build- name: Upload artifactuses: actions/upload-pages-artifact@v3with:path: ./distdeploy:needs: buildruns-on: ubuntu-latestenvironment:name: github-pagesurl: ${{ steps.deployment.outputs.page_url }}steps:- name: Deploy to GitHub Pagesid: deploymentuses: actions/deploy-pages@v4 -
GitHub Pages 설정
- 저장소의 Settings → Pages로 이동
- Source에서 GitHub Actions 선택
- 설정 저장
-
푸시하여 배포
Terminal window git add .git commit -m "Add GitHub Pages deployment"git push사이트는
https://username.github.io/repository-name에서 사용 가능합니다
커스텀 도메인
커스텀 도메인을 사용하려면:
-
public/에CNAME파일 생성:public/CNAME your-domain.com -
setting.toml업데이트:setting.toml site_url = "https://your-domain.com" -
도메인 제공업체에서 DNS 설정
다른 플랫폼
- Vercel에서 저장소 가져오기
- 빌드 설정 구성:
- Framework Preset:
Astro - Build Command:
npm run build - Output Directory:
dist
- Framework Preset:
- 배포
- Netlify에서 저장소 연결
- 빌드 설정 구성:
- Build Command:
npm run build - Publish Directory:
dist
- Build Command:
- 배포
- Cloudflare Pages에서 저장소 연결
- 빌드 설정 구성:
- Framework Preset:
Astro - Build Command:
npm run build - Build output directory:
dist
- Framework Preset:
- 배포
Docker
Docker 컨테이너로 블로그를 실행할 수 있습니다. 마크다운 폴더와 setting.toml만 마운트하면 동기화, 빌드, 서빙을 컨테이너가 자동으로 처리합니다.
사전 요구사항
- Docker 설치
빠른 시작
-
setting.toml에서source_root_path설정컨테이너에서 마크다운 폴더는
/source에 마운트되므로, 경로를 맞춰야 합니다:setting.toml source_root_path = "/source" -
Docker 이미지 빌드
Terminal window docker build -t girok-md . -
컨테이너 실행
Terminal window docker run -d -p 8080:8080 \-v /마크다운/폴더/경로:/source:ro \-v ./setting.toml:/app/setting.toml:ro \girok-md/마크다운/폴더/경로를 실제 마크다운 파일 폴더 경로로 변경하세요:ro는 읽기 전용으로, 원본 파일을 수정하지 않습니다http://localhost:8080에서 블로그에 접속할 수 있습니다
Docker Compose 사용
더 간편하게 docker-compose.yml을 편집하고 한 줄로 실행할 수 있습니다:
services: blog: build: . ports: - "8080:8080" volumes: - /마크다운/폴더/경로:/source:ro - ./setting.toml:/app/setting.toml:rodocker compose up -d동작 방식
컨테이너 시작 시 세 단계를 순서대로 실행합니다:
- 동기화 —
/source에서 마크다운 파일을 프로젝트로 복사 - 빌드 — 정적 HTML 페이지와 검색 인덱스 생성
- 서빙 — Nginx 웹 서버가 8080 포트에서 빌드된 사이트 제공
콘텐츠 변경 후 재빌드
컨테이너는 시작 시 한 번만 빌드합니다. 새로운 마크다운 파일을 반영하려면 컨테이너를 재시작하세요:
docker compose down && docker compose up -d수동 배포
로컬에서 빌드하고 정적 호스트에 업로드:
npm run build빌드된 사이트는 dist/ 폴더에 있습니다:
디렉터리dist/
- index.html
디렉터리posts/
디렉터리my-first-post/
- index.html
디렉터리tags/
- …
디렉터리pagefind/
- …
디렉터리assets/
- …
디렉터리_astro/
- …
dist/ 내용을 웹 서버에 업로드하세요.
빌드 설정
Base Path
하위 디렉토리에 배포하는 경우 (예: username.github.io/blog), astro.config.mjs 업데이트:
export default defineConfig({ site: 'https://username.github.io', base: '/blog', // ...});환경 변수
프로덕션 빌드에서 환경 변수를 사용할 수 있습니다:
PUBLIC_SITE_URL=https://your-site.com npm run build