danielrayjones/Makefile

32 lines
904 B
Makefile
Raw Normal View History

.PHONY: all serve clean
2019-08-19 11:29:07 -05:00
2017-06-04 22:05:40 -05:00
export PATH := $(HOME)/bin:$(PATH):/usr/local/bin
PORT ?= 4000
2023-03-29 14:40:35 -05:00
IMAGE=danjones000/danielrayjones/ruby-with-bundler:1.0.1
2017-06-04 22:05:40 -05:00
2023-11-21 16:39:41 -06:00
ifeq ($(shell command -v podman 2> /dev/null),)
CMD=docker
else
CMD=podman
endif
all: serve
2017-06-04 22:05:40 -05:00
2020-02-21 08:59:50 -06:00
Gemfile.lock:
2023-11-21 16:39:41 -06:00
$(CMD) run --rm -v $(shell pwd):/app -w /app ruby:2.7 sh -c 'gem install bundler:2.0.2 && bundle install'
2020-02-21 08:59:50 -06:00
2023-03-29 14:40:35 -05:00
.image: Dockerfile Gemfile.lock
2023-11-21 16:39:41 -06:00
$(CMD) build -t $(IMAGE) .
$(CMD) image inspect $(IMAGE) | jq -r '.[0].Id' | tee .image
2019-08-19 11:29:07 -05:00
2020-02-20 16:48:05 -06:00
_config.local.yml:
touch $@
_site/index.html: .image _config.local.yml index.html
2023-11-21 16:39:41 -06:00
$(CMD) run --rm -v $(shell pwd):/app:rw -w /app $(IMAGE) bundle exec jekyll build -c '_config.yml,_config.local.yml'
2019-08-19 11:29:07 -05:00
serve: _site/index.html
2023-11-21 16:39:41 -06:00
$(CMD) 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'
2017-06-04 22:05:40 -05:00
2019-08-19 11:29:07 -05:00
clean:
rm -rf _site