Skip to content

Commit 5183747

Browse files
committed
feat(docs): Improve jekyll dependencies to speed up docker image build
1 parent 718f81b commit 5183747

File tree

3 files changed

+31
-27
lines changed

3 files changed

+31
-27
lines changed

Diff for: Dockerfile

+15-10
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,26 @@ WORKDIR /app
9696

9797
FROM base as build
9898

99+
# copy NPM dependencies and install
99100
COPY --chown=abc:abc package*.json ./
100101
COPY --chown=abc:abc tsconfig.json .
101102

102103
RUN npm install
103104

105+
# copy bundle/jekyll dependencies and docs folder
106+
COPY --chown=abc:abc Gemfile Gemfile.lock _config.yml ./
107+
COPY --chown=abc:abc docs ./docs/
108+
109+
# sassc (a jekll dependency) is very slow to compile bc there are no alpine binaries
110+
# https://github.com/sass/sassc-ruby/issues/189#issuecomment-629758948
111+
# so for now sync used jekyll version with prebuilt binary available in alpine repo
112+
RUN apk add --no-cache --virtual .build-deps \
113+
ruby-jekyll \
114+
&& bundle install \
115+
&& jekyll build -b /docs \
116+
&& apk del .build-deps \
117+
&& rm -rf docs
118+
104119
COPY --chown=abc:abc . /app
105120

106121
RUN npm run build && rm -rf node_modules
@@ -115,16 +130,6 @@ RUN npm install --production \
115130
&& rm -rf node_modules/ts-node \
116131
&& rm -rf node_modules/typescript
117132

118-
# https://github.com/sass/sassc-ruby/issues/189#issuecomment-629758948
119-
# sassc is very slow to compile bc there are no alpine binaries
120-
RUN apk add --no-cache --virtual .build-deps \
121-
make gcc g++ ruby-bundler ruby-dev \
122-
&& gem install bundler:2.3.9 \
123-
&& bundle install \
124-
&& bundle exec jekyll build -b /docs \
125-
&& apk del .build-deps \
126-
&& rm -rf docs
127-
128133
ENV NPM_CONFIG_LOGLEVEL debug
129134

130135
# can set database to use more performant better-sqlite3 since we control everything

Diff for: Gemfile

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
source 'https://rubygems.org'
22

3-
gem "jekyll", "~> 4.3" # installed by `gem jekyll`
3+
# sassc (a jekll dependency) is very slow to compile bc there are no alpine binaries
4+
# https://github.com/sass/sassc-ruby/issues/189#issuecomment-629758948
5+
# so for now sync used jekyll version with prebuilt binary available in alpine repo
6+
gem "jekyll", "4.2.2" # installed by `gem jekyll`
47
# gem "webrick" # required when using Ruby >= 3 and Jekyll <= 4.2.2
58

69
gem "just-the-docs", "0.4.0.rc3" # currently the latest pre-release

Diff for: Gemfile.lock

+12-16
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,21 @@ GEM
1414
http_parser.rb (0.8.0)
1515
i18n (1.12.0)
1616
concurrent-ruby (~> 1.0)
17-
jekyll (4.3.0)
17+
jekyll (4.2.2)
1818
addressable (~> 2.4)
1919
colorator (~> 1.0)
2020
em-websocket (~> 0.5)
2121
i18n (~> 1.0)
22-
jekyll-sass-converter (>= 2.0, < 4.0)
22+
jekyll-sass-converter (~> 2.0)
2323
jekyll-watch (~> 2.0)
24-
kramdown (~> 2.3, >= 2.3.1)
24+
kramdown (~> 2.3)
2525
kramdown-parser-gfm (~> 1.0)
2626
liquid (~> 4.0)
27-
mercenary (>= 0.3.6, < 0.5)
27+
mercenary (~> 0.4.0)
2828
pathutil (~> 0.9)
29-
rouge (>= 3.0, < 5.0)
29+
rouge (~> 3.0)
3030
safe_yaml (~> 1.0)
31-
terminal-table (>= 1.8, < 4.0)
32-
webrick (~> 1.7)
31+
terminal-table (~> 2.0)
3332
jekyll-default-layout (0.1.5)
3433
jekyll (>= 3.0, < 5.0)
3534
jekyll-optional-front-matter (0.3.2)
@@ -67,22 +66,19 @@ GEM
6766
rb-inotify (0.10.1)
6867
ffi (~> 1.0)
6968
rexml (3.2.5)
70-
rouge (4.0.0)
69+
rouge (3.30.0)
7170
safe_yaml (1.0.5)
7271
sassc (2.4.0)
7372
ffi (~> 1.9)
74-
terminal-table (3.0.2)
75-
unicode-display_width (>= 1.1.1, < 3)
76-
unicode-display_width (2.3.0)
77-
webrick (1.7.0)
73+
terminal-table (2.0.0)
74+
unicode-display_width (~> 1.1, >= 1.1.1)
75+
unicode-display_width (1.8.0)
7876

7977
PLATFORMS
80-
arm64-darwin-21
81-
x86_64-darwin-19
8278
x86_64-linux
8379

8480
DEPENDENCIES
85-
jekyll (~> 4.3)
81+
jekyll (= 4.2.2)
8682
jekyll-default-layout
8783
jekyll-optional-front-matter
8884
jekyll-readme-index
@@ -91,4 +87,4 @@ DEPENDENCIES
9187
just-the-docs (= 0.4.0.rc3)
9288

9389
BUNDLED WITH
94-
2.3.9
90+
2.3.25

0 commit comments

Comments
 (0)