Skip to content

Commit 031698e

Browse files
committed
Add docker support instructions to the docs.
1 parent b22bcb8 commit 031698e

File tree

2 files changed

+70
-8
lines changed

2 files changed

+70
-8
lines changed

Diff for: README.md

+35-4
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,14 @@ In order to generate some extra files (_categories_, _tags_ and _last modified l
7272
$ brew install coreutils
7373
```
7474

75+
### Setting up Docker environment (optional)
76+
77+
If you're a loyal fan of [**Docker**](https://www.docker.com/) or just too lazy to install the packages mentioned in [_Setting up the local envrionment_](#setting-up-the-local-envrionment), please make sure you have **Docker Engine** installed and running, and then get Docker image `jekyll/jekyll` from Docker Hub by the following command:
78+
79+
```console
80+
$ docker pull jekyll/jekyll:latest
81+
```
82+
7583
## Usage
7684

7785
Running [**Chirpy**](https://github.com/cotes2020/jekyll-theme-chirpy/) requires some extra files, which cannot be generated by Jekyll native commands, so please strictly follow the methods mentioned below to run or deploy your website.
@@ -119,6 +127,19 @@ Then open a browser and visit to <http://localhost:4000>.
119127

120128
Few days later, you may find that the file changes does not refresh in real time by using `run.sh`. Don't worry, the advanced option `-r` (or `--realtime`) will solve this problem, but it requires [**fswatch**](http://emcrisostomo.github.io/fswatch/) to be installed on your machine.
121129

130+
### Run on Docker
131+
132+
Run the site on Docker with the following command:
133+
134+
```terminal
135+
$ docker run --rm -it \
136+
--volume="$PWD:/srv/jekyll" \
137+
-p 4000:4000 jekyll/jekyll \
138+
bash tools/run.sh --docker
139+
```
140+
141+
Please note that on Docker containers, you'll lose the real-time refresh feature.
142+
122143
### Deployment
123144

124145
Before the deployment begins, checkout the file `_config.yml` and make sure the `url` is configured correctly. Furthermore, if you prefer the [_project site_](https://help.github.com/en/github/working-with-github-pages/about-github-pages#types-of-github-pages-sites) and don't use a custom domain, or you want to visit your website with a base url on a web server other than **GitHub Pages**, remember to change the `baseurl` to your project name that starting with a slash. For example, `/project`.
@@ -131,8 +152,7 @@ For security reasons, GitHub Pages build runs on `safe` mode, which restricts us
131152

132153
1. Push any commit to `origin/master` to trigger the GitHub Actions workflow. Once the build is complete and successful, a new remote branch named `gh-pages` will appear to store the built site files.
133154

134-
2. Browse to your repository on GitHub and choose the branch `gh-pages` as the [publishing source](https://docs.github.com/en/github/working-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site) throught _Settings_
135-
_Options__GitHub Pages_:
155+
2. Browse to your repository on GitHub and choose the branch `gh-pages` as the [publishing source](https://docs.github.com/en/github/working-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site) throught _Settings__Options__GitHub Pages_:
136156
![gh-pages-sources](https://raw.githubusercontent.com/cotes2020/jekyll-theme-chirpy/master/assets/img/sample/gh-pages-sources.png)
137157

138158
3. Visit your website at the address indicated by GitHub.
@@ -144,10 +164,21 @@ On platforms other than GitHub, we cannot enjoy the convenience of **GitHub Acti
144164
Go to the root of the source project, build your site by:
145165

146166
```console
147-
$ bash tools/build.sh -d /path/to/site/
167+
$ bash tools/build.sh
168+
```
169+
170+
> **Note**: The output path can be specified with the option `-d`.
171+
172+
Or, build the site with Docker by:
173+
174+
```terminal
175+
$ docker run --rm -it \
176+
--volume="$PWD:/srv/jekyll" \
177+
jekyll/jekyll \
178+
bash tools/build.sh --docker
148179
```
149180

150-
The generated site files will be placed in folder `/path/to/site/`. Now you should upload those files to your web server.
181+
Unless you specified the output path, the generated site files will be placed in folder `_site` of the project's root directory. Now you should upload those files to your web server.
151182

152183
### Documentation
153184

Diff for: _posts/2019-08-09-getting-started.md

+35-4
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,14 @@ In order to generate some extra files (_categories_, _tags_ and _last modified l
4242
$ brew install coreutils
4343
```
4444

45+
### Setting up Docker environment (optional)
46+
47+
If you're a loyal fan of [**Docker**](https://www.docker.com/) or just too lazy to install the packages mentioned in [_Setting up the local envrionment_](#setting-up-the-local-envrionment), please make sure you have **Docker Engine** installed and running, and then get Docker image `jekyll/jekyll` from Docker Hub by the following command:
48+
49+
```console
50+
$ docker pull jekyll/jekyll:latest
51+
```
52+
4553
## Usage
4654

4755
Running [**Chirpy**](https://github.com/cotes2020/jekyll-theme-chirpy/) requires some extra files, which cannot be generated by Jekyll native commands, so please strictly follow the methods mentioned below to run or deploy your website.
@@ -89,6 +97,19 @@ Then open a browser and visit to <http://localhost:4000>.
8997

9098
Few days later, you may find that the file changes does not refresh in real time by using `run.sh`. Don't worry, the advanced option `-r` (or `--realtime`) will solve this problem, but it requires [**fswatch**](http://emcrisostomo.github.io/fswatch/) to be installed on your machine.
9199

100+
### Run on Docker
101+
102+
Run the site on Docker with the following command:
103+
104+
```terminal
105+
$ docker run --rm -it \
106+
--volume="$PWD:/srv/jekyll" \
107+
-p 4000:4000 jekyll/jekyll \
108+
bash tools/run.sh --docker
109+
```
110+
111+
Please note that on Docker containers, you'll lose the real-time refresh feature.
112+
92113
### Deployment
93114

94115
Before the deployment begins, checkout the file `_config.yml` and make sure the `url` is configured correctly. Furthermore, if you prefer the [_project site_](https://help.github.com/en/github/working-with-github-pages/about-github-pages#types-of-github-pages-sites) and don't use a custom domain, or you want to visit your website with a base url on a web server other than **GitHub Pages**, remember to change the `baseurl` to your project name that starting with a slash. For example, `/project`.
@@ -101,8 +122,7 @@ For security reasons, GitHub Pages build runs on `safe` mode, which restricts us
101122

102123
1. Push any commit to `origin/master` to trigger the GitHub Actions workflow. Once the build is complete and successful, a new remote branch named `gh-pages` will appear to store the built site files.
103124

104-
2. Browse to your repository on GitHub and choose the branch `gh-pages` as the [publishing source](https://docs.github.com/en/github/working-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site) throught _Settings_
105-
_Options__GitHub Pages_:
125+
2. Browse to your repository on GitHub and choose the branch `gh-pages` as the [publishing source](https://docs.github.com/en/github/working-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site) throught _Settings__Options__GitHub Pages_:
106126
![gh-pages-sources](/assets/img/sample/gh-pages-sources.png){: width="650"}
107127

108128
3. Visit your website at the address indicated by GitHub.
@@ -114,7 +134,18 @@ On platforms other than GitHub, we cannot enjoy the convenience of **GitHub Acti
114134
Go to the root of the source project, build your site by:
115135

116136
```console
117-
$ bash tools/build.sh -d /path/to/site/
137+
$ bash tools/build.sh
138+
```
139+
140+
> **Note**: The output path can be specified with the option `-d`.
141+
142+
Or, build the site with Docker by:
143+
144+
```terminal
145+
$ docker run --rm -it \
146+
--volume="$PWD:/srv/jekyll" \
147+
jekyll/jekyll \
148+
bash tools/build.sh --docker
118149
```
119150

120-
The generated site files will be placed in folder `/path/to/site/`. Now you should upload those files to your web server.
151+
Unless you specified the output path, the generated site files will be placed in folder `_site` of the project's root directory. Now you should upload those files to your web server.

0 commit comments

Comments
 (0)