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 ```bash
$ curl -fsSL https://get.docker.com -o get-docker.sh # have a look if you want $ 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. Fire up the container with the following.
```bash ```bash
$ make dockerserver $ make serve
``` ```
Then visit the locally running website. 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. 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 ## Notes
1. For configuration, please note, we now use a `dev` environment config file: 1. For configuration, please note, we now use a `dev` environment config file:

View File

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

View File

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