Update makefile
This commit is contained in:
parent
a466088b59
commit
ad3aeceb07
1 changed files with 2 additions and 47 deletions
49
Makefile
49
Makefile
|
@ -19,7 +19,8 @@ sass-uncompressed:
|
|||
lektor build
|
||||
|
||||
install:
|
||||
pip install lektor
|
||||
pip install lektor --user
|
||||
gem install sass
|
||||
|
||||
build: sass
|
||||
lektor build
|
||||
|
@ -27,49 +28,3 @@ build: sass
|
|||
server:
|
||||
lektor server $(LEKTOR_SERVER_FLAGS)
|
||||
|
||||
## Docker stuff
|
||||
IMAGE_TAG:=v1.2.0
|
||||
IMAGE:=toolboxbodensee/lektor:$(IMAGE_TAG)
|
||||
|
||||
PWD:=$(shell pwd)
|
||||
|
||||
CACHE:=$(HOME)/.cache
|
||||
PWD:=$(shell pwd)
|
||||
|
||||
LEKTOR_CACHE:=$(CACHE)/lektor
|
||||
CACHE_VOL:=-v $(CACHE)/lektor:/home/lektor/.cache/lektor
|
||||
SOURCE_VOL:=-v $(PWD):/opt/lektor
|
||||
|
||||
EXPORTED_PORTS=-p 5000:5000
|
||||
|
||||
DOCKER:=docker
|
||||
|
||||
# On linux...
|
||||
ifeq ($(shell uname),Linux)
|
||||
# When user is not in docker group
|
||||
ifneq ($(findstring docker,$(shell groups)),docker)
|
||||
# And the user is not root
|
||||
ifneq ($(shell whoami),root)
|
||||
# Run docker client inside docker group
|
||||
DOCKER:=sudo -E -g docker docker
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
RUN:=run --rm -it $(SOURCE_VOL) $(CACHE_VOL)
|
||||
|
||||
$(LEKTOR_CACHE):
|
||||
mkdir -p $(LEKTOR_CACHE)
|
||||
|
||||
docker-pull:
|
||||
$(DOCKER) pull $(IMAGE)
|
||||
|
||||
docker-build: docker-pull $(LEKTOR_CACHE)
|
||||
$(DOCKER) $(RUN) $(IMAGE) make build
|
||||
|
||||
docker-shell: $(LEKTOR_CACHE) docker-pull
|
||||
$(DOCKER) $(RUN) $(EXPORTED_PORTS) $(IMAGE) /bin/sh
|
||||
|
||||
docker-server: $(LEKTOR_CACHE) docker-pull
|
||||
$(DOCKER) $(RUN) $(EXPORTED_PORTS) $(IMAGE) make sass
|
||||
$(DOCKER) $(RUN) $(EXPORTED_PORTS) $(IMAGE) lektor server -h 0.0.0.0
|
||||
|
|
Loading…
Reference in a new issue