mirror of
https://github.com/0xAX/linux-insides.git
synced 2024-12-22 06:38:07 +00:00
Merge pull request #786 from dexterp/task-automation-makefile
Add Makefile for task automation
This commit is contained in:
commit
259a219ec6
25
Makefile
Normal file
25
Makefile
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
### HELP
|
||||||
|
|
||||||
|
.PHONY: help
|
||||||
|
help: ## Print help
|
||||||
|
@egrep "(^### |^\S+:.*##\s)" Makefile | sed 's/^###\s*//' | sed 's/^\(\S*\)\:.*##\s*\(.*\)/ \1 - \2/'
|
||||||
|
|
||||||
|
### DOCKER
|
||||||
|
|
||||||
|
.PHONY: run
|
||||||
|
run: image ## docker run ...
|
||||||
|
(docker stop linux-insides-book 2>&1) > /dev/null || true
|
||||||
|
docker run --detach --rm -p 4000:4000 --name linux-insides-book --hostname linux-insides-book linux-insides-book
|
||||||
|
|
||||||
|
.PHONY: image
|
||||||
|
image: ## docker image build ...
|
||||||
|
docker image build --rm --squash --label linux-insides --tag linux-insides-book:latest -f Dockerfile . 2> /dev/null || \
|
||||||
|
docker image build --rm --label linux-insides --tag linux-insides-book:latest -f Dockerfile .
|
||||||
|
|
||||||
|
### LAUNCH BROWSER
|
||||||
|
|
||||||
|
.PHONY: browse
|
||||||
|
browse: ## Launch broweser
|
||||||
|
@timeout 60 sh -c 'until nc -z 127.0.0.1 4000; do sleep 1; done' || true
|
||||||
|
@(uname | grep Darwin > /dev/null) && open http://127.0.0.1:4000 || true
|
||||||
|
@(uname | grep Linux > /dev/null) && xdg-open http://127.0.0.1:4000 || true
|
22
README.md
22
README.md
@ -63,28 +63,14 @@ In order to run your own copy of the book with gitbook within a local container:
|
|||||||
systemctl restart docker.service
|
systemctl restart docker.service
|
||||||
```
|
```
|
||||||
|
|
||||||
2. Build container image
|
2. Run docker image
|
||||||
```bash
|
```bash
|
||||||
docker image build \
|
make run
|
||||||
--rm --squash \
|
|
||||||
--label linux-insides \
|
|
||||||
--tag linux-insides-book:latest \
|
|
||||||
-f Dockerfile .
|
|
||||||
```
|
```
|
||||||
|
|
||||||
3. Create and run book in local container
|
3. Open your local copy of linux insides book under this url
|
||||||
```bash
|
http://localhost:4000 or run `make browse`
|
||||||
docker run \
|
|
||||||
--detach \
|
|
||||||
--rm \
|
|
||||||
-p 4000:4000 \
|
|
||||||
--name linux-insides-book \
|
|
||||||
--hostname linux-insides-book \
|
|
||||||
linux-insides-book
|
|
||||||
```
|
|
||||||
|
|
||||||
4. Open your local copy of linux insides book under this url
|
|
||||||
http://localhost:4000
|
|
||||||
|
|
||||||
Contributions
|
Contributions
|
||||||
--------------
|
--------------
|
||||||
|
@ -134,4 +134,5 @@ Thank you to all contributors:
|
|||||||
* [Yuxin Wu](https://github.com/chaffz)
|
* [Yuxin Wu](https://github.com/chaffz)
|
||||||
* [Biao Ding](https://github.com/SmallPond)
|
* [Biao Ding](https://github.com/SmallPond)
|
||||||
* [Arfy slowy](https://github.com/slowy07)
|
* [Arfy slowy](https://github.com/slowy07)
|
||||||
|
* [Dexter Plameras](https://github.com/dexterp)
|
||||||
* [Jun Duan](https://github.com/waltforme)
|
* [Jun Duan](https://github.com/waltforme)
|
||||||
|
Loading…
Reference in New Issue
Block a user