Add make stop and allow --incremental

[ci skip]
This commit is contained in:
Luke Murphy 2020-04-18 19:44:48 +02:00
parent 8463aa2342
commit 9f1dd6284b
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC
3 changed files with 37 additions and 16 deletions

View File

@ -24,13 +24,13 @@ The only prerequisite is [Docker](https://www.docker.com/). If you're on Debian,
```bash
$ curl -fsSL https://get.docker.com -o get-docker.sh # have a look if you want
$ sh get-docker.sh
$ CHANNEL=stable sh get-docker.sh
```
Fire up the container with the following.
```bash
$ make dockerserver
$ make serve
```
Then visit the locally running website.
@ -39,6 +39,12 @@ Then visit the locally running website.
Then you can edit the files as normal and reload the page.
To stop the container when you're done, you can run:
```bash
$ make stop
```
## Notes
1. For configuration, please note, we now use a `dev` environment config file:

View File

@ -1,14 +1,26 @@
dockerbuild:
@docker build -t autonomic/autonomic.zone:testing .
.PHONY: dockerbuild
IMG := autonomic/autonomic.zone
NAME := autonomic-zone-testing
PORT := 4000
TAG := testing
dockerserver: dockerbuild
build:
@docker build -t $(IMG):$(TAG) .
.PHONY: build
stop:
@docker stop $(NAME) && docker rm $(NAME) --force
.PHONY: stop
serve: build
@docker run \
-e JEKYLL_PORT=4000 \
--name $(NAME) \
-e JEKYLL_PORT=$(PORT) \
-e JEKYLL_HOST=0.0.0.0 \
-e JEKYLL_CONFIG=_config_dev.yml \
-e JEKYLL_ENV=development \
-v $$(pwd):/usr/src/app \
-p 4000:4000 \
-p $(PORT):$(PORT) \
-d \
autonomic/autonomic.zone:testing
.PHONY: dockerserver
$(IMG):$(TAG) && \
echo "Site available at http://localhost:4000"
.PHONY: serve

View File

@ -6,12 +6,15 @@ set -eu -o pipefail
run_jekyll() {
set -eu
bundle exec jekyll serve \
--config "$JEKYLL_CONFIG" \
--host "$JEKYLL_HOST" \
--port "$JEKYLL_PORT" \
--trace \
--verbose
# shellcheck disable=SC2155
local args="--config $JEKYLL_CONFIG --host $JEKYLL_HOST --port $JEKYLL_PORT --trace --verbose"
if [[ $JEKYLL_ENV == "development" ]]; then
# shellcheck disable=SC2155
local args="${args} --incremental"
fi
bundle exec jekyll serve $args
}
# Main entrypoint