Add make stop and allow --incremental #20

Merged
decentral1se merged 1 commits from stop-and-incremental into master 2020-04-18 17:47:14 +00:00
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