๐ฉ ๋ฌธ์
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)