Skip to content

Commit 1b2ddee

Browse files
jinnabaaluJinna Baluvsoch
authored
Jekyll containerisation (#17)
* Jekyll containerisation * docker-compose conf * Update docker-compose.yaml * adding more detailed instructions to README, and we are still needing to debug an issue with bringing up the latest jekyll container (4.0.0) that seems to have a permissions error to write to /usr/gem/cache that does not exist in the container Signed-off-by: vsoch <[email protected]> * updating jekyll/jekyll to use 3.8 as 4.0 has permissions error bug Signed-off-by: vsoch <[email protected]> Co-authored-by: Jinna Balu <[email protected]> Co-authored-by: vsoch <[email protected]>
1 parent 6947027 commit 1b2ddee

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed

Diff for: README.md

+44
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,47 @@ jekyll serve
5252
# or
5353
bundle exec jekyll serve
5454
```
55+
56+
### 5. Run as a container in dev or prod
57+
58+
#### Software Dependencies
59+
60+
If you want to run docsy jekyll via a container for development (dev) or production (prod) you can use containers. This approach requires installing [docker-ce](https://docs.docker.com/engine/install/ubuntu/) and [docker-compose](https://docs.docker.com/compose/install/).
61+
62+
#### Customization
63+
64+
Note that the [docker-compose.yml](docker-compose.yml) file is using the [jekyll/jekyll:3.8](https://hub.docker.com/r/jekyll/jekyll/tags) image. If you want to make your build more reproducible, you can specify a particular version for jekyll (tag). Note that at the development time of writing this documentation, the latest was tag 4.0.0,
65+
and it [had a bug](https://github.com/fastai/fastpages/issues/267#issuecomment-620612896) that prevented the server from deploying.
66+
67+
If you are deploying a container to production, you should remove the line to
68+
mount the bundles directory to the host in the docker-compose.yml. Change:
69+
70+
```yaml
71+
volumes:
72+
- "./:/srv/jekyll"
73+
- "./vendor/bundle:/usr/local/bundle"
74+
# remove "./vendor/bundle:/usr/local/bundle" volume when deploying in production
75+
```
76+
77+
to:
78+
79+
```yaml
80+
volumes:
81+
- "./:/srv/jekyll"
82+
```
83+
84+
This additional volume is optimal for development so you can cache the bundle dependencies,
85+
but should be removed for production.
86+
87+
#### Start Container
88+
89+
Once your docker-compose to download the base container and bring up the server:
90+
91+
```bash
92+
docker-compose up -d
93+
```
94+
95+
You can then open your browser to [http://localhost:4000](http://localhost:4000)
96+
to see the server running.
97+
98+
> Node : changes `baseurl: ""` in _config.yml when you are running in local and prod according to the requirement.

Diff for: docker-compose.yaml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version: '3.7'
2+
services:
3+
site:
4+
container_name: docsy
5+
command: jekyll serve --watch --drafts
6+
image: jekyll/jekyll:3.8
7+
volumes:
8+
- "./:/srv/jekyll"
9+
- "./vendor/bundle:/usr/local/bundle"
10+
# remove "./vendor/bundle:/usr/local/bundle" volume when deploying in production
11+
ports:
12+
- "4000:4000"

0 commit comments

Comments
 (0)