diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..cd2b5f4 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,7 @@ +FROM ruby:2.6.3 + +RUN gem install bundler:2.0.2 && \ + bundle config --global frozen 1 + +COPY Gemfile Gemfile.lock ./ +RUN bundle install diff --git a/Makefile b/Makefile index 023f284..2656541 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,19 @@ +.PHONY: all build-image serve clean + export PATH := $(HOME)/bin:$(PATH):/usr/local/bin -IP ?= 127.0.0.1 PORT ?= 4000 +IMAGE=ruby-with-bundler:2.6.3-2.0.2 all: serve -stage: - bundle exec jekyll build -c '_config.yml,_config.local.yml' +build-image: + docker build -t $(IMAGE) . -serve: - bundle exec jekyll serve -H "$(IP)" -P "$(PORT)" -c '_config.yml,_config.local.yml' +_site/index.html: build-image + docker run -u $(shell id -u) --rm -v $(shell pwd):/app -w /app $(IMAGE) bundle exec jekyll build -c '_config.yml,_config.local.yml' + +serve: _site/index.html + docker run --rm -it -v $(shell pwd):/app -w /app -p $(PORT):$(PORT) $(IMAGE) bundle exec jekyll serve -H 0.0.0.0 -P "$(PORT)" -c '_config.yml,_config.local.yml' + +clean: + rm -rf _site