๐Ÿ˜ฉ ๋ฌธ์ œ

Jekyll์„ Docker๋กœ ์„ธํŒ…ํ•˜๋Š” ๊ฑด ์‰ฌ์›Œ ๋ณด์˜€์ง€๋งŒ, ์‹ค์ œ๋กœ๋Š” ์—ฌ๋Ÿฌ ๋ฌธ์ œ๋ฅผ ๊ฒช์—ˆ์Šต๋‹ˆ๋‹ค:

  • ํ”Œ๋žซํผ ์ด์Šˆ (arm64 vs amd64) - Apple Silicon Macbook (M1)์„ ์‚ฌ์šฉ์ค‘
  • bundle install์—์„œ ๋ฐœ์ƒํ•˜๋Š” ์˜ค๋ฅ˜๋“ค

๊ฐœ์ธ GitHub Pages ์‚ฌ์ดํŠธ์šฉ์œผ๋กœ ๋งŒ๋“ค๊ณ  ์žˆ์—ˆ๊ธฐ ๋•Œ๋ฌธ์—, GitHub Pages์—์„œ ์‚ฌ์šฉํ•˜๋Š” gem ๋ฒ„์ „๊ณผ ํ˜ธํ™˜๋˜๋ฉด์„œ๋„ ๋กœ์ปฌ์—์„œ ๊ฐœ๋ฐœํ•˜๊ธฐ ์‰ฝ๊ฒŒ ์œ ์ง€ํ•ด์•ผ ํ–ˆ์Šต๋‹ˆ๋‹ค.

๐Ÿ›  ๋‚˜์˜ ๊น”๋”ํ•œ ํ•ด๊ฒฐ์ฑ…

๊ฒฐ๊ตญ ์ด Docker ์„ธํŒ…์„ ๋งŒ๋“ค๊ฒŒ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ์ €์—๊ฒŒ๋Š” ์ž˜ ์ž‘๋™ํ•ฉ๋‹ˆ๋‹ค.

โœ… Key Features

  • Apple Silicon (M1/M2)์™€ Intel ๋ชจ๋‘์—์„œ ๋™์ž‘
  • ๊น”๋”ํ•˜๊ฒŒ ๋‹ค์‹œ ๋นŒ๋“œ ๊ฐ€๋Šฅํ•œ ์ด๋ฏธ์ง€
  • ๋ณผ๋ฅจ ๋งˆ์šดํŠธ๋ฅผ ํ†ตํ•œ ์•ˆ์ •์ ์ธ ํŒŒ์ผ ๋™๊ธฐํ™”
  • GitHub Pages์˜ Jekyll ๋ฒ„์ „๊ณผ ํ˜ธํ™˜
  • (์„ ํƒ ์‚ฌํ•ญ) livereload ์ง€์›

๐Ÿณ The Dockerfile

FROM ruby:3.2.3-slim

RUN apt-get update -qq && \
    apt-get install -y build-essential libpq-dev nodejs npm

RUN gem install bundler -v 2.6.9

WORKDIR /srv/jekyll

COPY Gemfile* ./

RUN bundle install

COPY . .

EXPOSE 4000

CMD ["bundle", "exec", "jekyll", "serve", "--host", "0.0.0.0", "--force_polling", "--livereload"]

๐Ÿณ docker-compose.yml

services:
  site:
    image: my-jekyll
    platform: linux/arm64
    command: bundle exec jekyll serve --host 0.0.0.0 --force_polling --livereload
    ports:
      - "4000:4000"
      - "35729:35729"
    volumes:
      - .:/srv/jekyll
      - ./vendor/bundle:/usr/local/bundle
    working_dir: /srv/jekyll
    environment:
      - JEKYLL_ENV=development

๐Ÿ’Ž Gemfile

source "https://rubygems.org"

gem "jekyll", "~> 4.3.3"
gem "csv", "~> 3.3.5"
gem "base64", "~> 0.2.0"
gem "logger", "~> 1.6.0"

group :jekyll_plugins do
  gem "jekyll-feed", "~> 0.17.0"
  gem "jekyll-seo-tag", "~> 2.8.0"
end

# Windows and JRuby does not include zoneinfo files, so bundle the tzinfo-data gem
# and associated library.
platforms :mingw, :x64_mingw, :mswin, :jruby do
  gem "tzinfo", ">= 1", "< 3"
  gem "tzinfo-data"
end

# Performance-booster for watching directories on Windows
gem "wdm", "~> 0.1.1", :platforms => [:mingw, :x64_mingw, :mswin]

# Lock `http_parser.rb` gem to `v0.6.x` on JRuby builds since newer versions of the gem
# do not have a Java counterpart.
gem "http_parser.rb", "~> 0.6.0", :platforms => [:jruby]

# Add webrick as it's no longer bundled with Ruby
gem "webrick", "~> 1.8" 

Gemfile.lock๋„ ๋ ˆํฌ์— ํฌํ•จ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.


๐Ÿ™ Docker์—๊ฒŒ ์‹ ์˜ ๊ฐ€ํ˜ธ๊ฐ€ ์žˆ๊ธฐ๋ฅผ. ๋นŒ๋“œ๋Š” ๋น ๋ฅด๊ฒŒ, ๋ณผ๋ฅจ์€ ์ •ํ™•ํžˆ ๋งˆ์šดํŠธ๋˜๊ณ , ํฌํŠธ ์ถฉ๋Œ์€ ์ ˆ๋Œ€ ๋ฐœ์ƒํ•˜์ง€ ์•Š๊ธฐ๋ฅผ. ํ–‰์šด์„ ๋น•๋‹ˆ๋‹ค!

๐Ÿ“ฆ ์ „์ฒด ๋ ˆํฌ

๐Ÿ‘‰ [GitHub Repo Link] (https://github.com/namikimlab/namikimlab.github.io/tree/main)