Skip to content

Commit ce4b1a0

Browse files
author
xaralis
committed
feat: Make build more accessible
1 parent a029e37 commit ce4b1a0

6 files changed

Lines changed: 70 additions & 44 deletions

File tree

.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
_site
2+
build.sh

Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ RUN apk --no-cache add \
55
file \
66
imagemagick
77

8-
CMD ["jekyll", "--help"]
9-
10-
ENTRYPOINT ["/usr/jekyll/bin/entrypoint"]
11-
128
WORKDIR /srv/jekyll
139

1410
VOLUME /srv/jekyll
1511

12+
COPY . /srv/jekyll
13+
14+
RUN bundle install
15+
1616
EXPOSE 35729
1717
EXPOSE 4000

README.md

Lines changed: 41 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,25 @@
55
## Table of contents
66

77
- [Fragaria.cz website](#fragariacz-website)
8-
- [Table of contents](#table-of-contents)
8+
- [Table of contents](#table-of-contents)
99
- [Creating posts](#creating-posts)
10-
- [Providing images for the posts](#providing-images-for-the-posts)
11-
- [Including images within the post body](#including-images-within-the-post-body)
12-
- [Including Youtube videos in the post body](#including-youtube-videos-in-the-post-body)
13-
- [Including embeddables like iframes](#including-embeddables-like-iframes)
14-
- [Highlighting code blocks](#highlighting-code-blocks)
10+
- [Providing images for the posts](#providing-images-for-the-posts)
11+
- [Including images within the post body](#including-images-within-the-post-body)
12+
- [Including Youtube videos in the post body](#including-youtube-videos-in-the-post-body)
13+
- [Including embeddables like iframes](#including-embeddables-like-iframes)
14+
- [Highlighting code blocks](#highlighting-code-blocks)
1515
- [Development](#development)
16-
- [Installation](#installation)
17-
- [Install build dependencies](#install-build-dependencies)
18-
- [Ubuntu 18.04](#ubuntu-1804)
19-
- [Fedora 28](#fedora-28)
20-
- [Install rbenv](#install-rbenv)
21-
- [Installing dependencies on macOS](#installing-dependencies-on-macos)
22-
- [Installing the app](#installing-the-app)
23-
- [Launching the app](#launching-the-app)
24-
- [Viewing future articles and drafts](#viewing-future-articles-and-drafts)
25-
- [Using Docker](#using-docker)
16+
- [Installation](#installation)
17+
- [Install build dependencies](#install-build-dependencies)
18+
- [Ubuntu 18.04](#ubuntu-1804)
19+
- [Fedora 28](#fedora-28)
20+
- [Install rbenv](#install-rbenv)
21+
- [Installing dependencies on macOS](#installing-dependencies-on-macos)
22+
- [Installing the app](#installing-the-app)
23+
- [Launching the app](#launching-the-app)
24+
- [Viewing future articles and drafts](#viewing-future-articles-and-drafts)
25+
- [Using Docker](#using-docker)
26+
- [Deployment](#deployment)
2627

2728
# Creating posts
2829

@@ -44,11 +45,11 @@ E.g.: `2014-10-20-ako-vyrobit-staticky-web-efektivne.md`
4445

4546
At minimum, following properties need to be declared in the front matter:
4647

47-
- `title`: title of your post
48-
- `date`: publication date of the post in ISO format (e.g. 2014-10-20T13:37:00.002+02:00)
49-
- `author`: your name
50-
- `lang`: language of the post (cs, sk, en)... we generally recommend writing all posts in English
51-
- `tags`: keywords of the post as a YAML array
48+
- `title`: title of your post
49+
- `date`: publication date of the post in ISO format (e.g. 2014-10-20T13:37:00.002+02:00)
50+
- `author`: your name
51+
- `lang`: language of the post (cs, sk, en)... we generally recommend writing all posts in English
52+
- `tags`: keywords of the post as a YAML array
5253

5354
## Providing images for the posts
5455

@@ -118,7 +119,6 @@ First, install required development dependencies:
118119

119120
#### Ubuntu 18.04
120121

121-
122122
```
123123
sudo apt-get update
124124
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev software-properties-common
@@ -175,8 +175,8 @@ Switch to the cloned repository:
175175
cd fragaria.cz
176176
```
177177

178-
Then, install Ruby gems using following from *within the
179-
repository directory*:
178+
Then, install Ruby gems using following from _within the
179+
repository directory_:
180180

181181
```
182182
rbenv install # Installs Ruby version required by the project
@@ -210,15 +210,14 @@ to get things up and running.
210210
First, make sure you have Docker along with `docker-comopose` installed. To do
211211
so, please follow a guide according to you OS of choice:
212212

213-
* [Windows](https://docs.docker.com/docker-for-windows/install/)
214-
* [macOS](https://docs.docker.com/docker-for-mac/install/)
215-
* [Ubuntu](https://docs.docker.com/install/linux/docker-ce/ubuntu/)
216-
* [Fedora](https://docs.docker.com/install/linux/docker-ce/fedora/)
213+
- [Windows](https://docs.docker.com/docker-for-windows/install/)
214+
- [macOS](https://docs.docker.com/docker-for-mac/install/)
215+
- [Ubuntu](https://docs.docker.com/install/linux/docker-ce/ubuntu/)
216+
- [Fedora](https://docs.docker.com/install/linux/docker-ce/fedora/)
217217

218218
`docker-compose` can be installed by following
219219
[official resources](https://docs.docker.com/compose/install/).
220220

221-
222221
**Note for Fedora**: It's better to run docker-compose without `sudo`. Please
223222
follow [this guide](https://bluntinstrumentsoftesting.com/2016/12/03/run-docker-without-sudo-in-fedora-25/)
224223
to allow running without it.
@@ -232,3 +231,16 @@ docker-compose up
232231

233232
First boot might take some time, but you should be presented with a running
234233
app after a while.
234+
235+
# Deployment
236+
237+
Use provided `build.sh` script. It will build the site using Docker and automatically commit to the `gh-pages` branch.
238+
You simply confirm your will by pushing:
239+
240+
```sh
241+
./build.sh
242+
git push
243+
```
244+
245+
Note: make sure you've committed all your work before running this as it will fail when switching to `gh-pages` branch
246+
otherwise.

_config.yml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ plugins:
3535
- jekyll-redirect-from
3636

3737
exclude:
38+
- .dockerignore
3839
- Dockerfile
3940
- docker-compose.yml
4041
- readme.md
@@ -45,6 +46,7 @@ exclude:
4546
- assets/favicons/README.md
4647
- .sass-cache
4748
- .travis
49+
- build.sh
4850
- node_modules
4951
- README.md
5052
- vendor/bundle/
@@ -57,13 +59,12 @@ exclude:
5759
permalink: /blog/:year/:month/:day/:title/
5860

5961
defaults:
60-
-
61-
scope:
62-
path: _posts
63-
values:
64-
layout: post
65-
lang: en
66-
tags: []
62+
- scope:
63+
path: _posts
64+
values:
65+
layout: post
66+
lang: en
67+
tags: []
6768

6869
# --------------------------- plugins ------------------------------------------
6970

@@ -105,7 +106,6 @@ service_worker:
105106
enabled: false
106107
cache_version: 5
107108

108-
109109
company:
110110
website_title: fragaria.cz
111111
official_name: Fragaria s.r.o.
@@ -133,4 +133,3 @@ company:
133133
github: fragaria
134134
stackshare: fragaria
135135
youtube: channel/UCz1zwJ9_6-IVdX6oCvq6T_g
136-

build.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
docker build . -t fragaria-website
6+
docker run -e JEKYLL_ENV=production -v $PWD:/srv/jekyll fragaria-website jekyll build --config '_config.yml,_config.witharchives.yml,_config.prod.yml'
7+
mkdir -p /tmp/fragaria-website-build
8+
cp -r _site/* /tmp/fragaria-website-build
9+
rm -rf _site
10+
git checkout gh-pages
11+
cp -r /tmp/fragaria-website-build/ .
12+
git cm -am "Automated build"
13+
14+

docker-compose.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
version: '3'
22
services:
33
site:
4-
command: >
5-
bash -c "bundle install && bundle exec jekyll serve --watch --livereload --host 0.0.0.0"
4+
command: jekyll serve --watch --livereload --host 0.0.0.0
65
build: .
76
volumes:
87
- .:/srv/jekyll

0 commit comments

Comments
 (0)