🛠 Only generate docker image when Gemfile is updated
This commit is contained in:
parent
cb5ba1429d
commit
939a28e5d8
2 changed files with 6 additions and 4 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -10,3 +10,4 @@ node_modules
|
||||||
package.json
|
package.json
|
||||||
|
|
||||||
_config.local.yml
|
_config.local.yml
|
||||||
|
.image
|
||||||
|
|
|
||||||
9
Makefile
9
Makefile
|
|
@ -1,18 +1,19 @@
|
||||||
.PHONY: all build-image serve clean
|
.PHONY: all serve clean
|
||||||
|
|
||||||
export PATH := $(HOME)/bin:$(PATH):/usr/local/bin
|
export PATH := $(HOME)/bin:$(PATH):/usr/local/bin
|
||||||
PORT ?= 4000
|
PORT ?= 4000
|
||||||
IMAGE=ruby-with-bundler:2.6.3-2.0.2
|
IMAGE=danjones000/danielrayjones/ruby-with-bundler:1.0.0
|
||||||
|
|
||||||
all: serve
|
all: serve
|
||||||
|
|
||||||
build-image:
|
.image: Gemfile Gemfile.lock
|
||||||
docker build -t $(IMAGE) .
|
docker build -t $(IMAGE) .
|
||||||
|
docker image inspect $(IMAGE) | jq -r '.[0].Id' | tee .image
|
||||||
|
|
||||||
_config.local.yml:
|
_config.local.yml:
|
||||||
touch $@
|
touch $@
|
||||||
|
|
||||||
_site/index.html: build-image _config.local.yml
|
_site/index.html: .image _config.local.yml
|
||||||
docker run -u $(shell id -u) --rm -v $(shell pwd):/app -w /app $(IMAGE) bundle exec jekyll build -c '_config.yml,_config.local.yml'
|
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
|
serve: _site/index.html
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue