Skip to content

Commit 8ef3c13

Browse files
committed
docker build alternative 🚢
1 parent 3cc3f49 commit 8ef3c13

File tree

5 files changed

+105
-5
lines changed

5 files changed

+105
-5
lines changed
File renamed without changes.

Dockerfile

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
ARG JEKYLL_BASEURL=''
2+
3+
####################################
4+
5+
FROM alpine:3.7 as builder
6+
7+
ENV LANGUAGE en_US.UTF-8
8+
ENV LANG en_US.UTF-8
9+
ENV LC_ALL en_US.UTF-8
10+
11+
ENV BUILD_PACKAGES \
12+
ruby \
13+
ruby-dev \
14+
ruby-rdoc \
15+
ruby-irb \
16+
gcc \
17+
make \
18+
libc-dev \
19+
libffi-dev \
20+
build-base
21+
22+
RUN apk add --no-cache $BUILD_PACKAGES \
23+
&& gem install bundle
24+
25+
WORKDIR /jekyll
26+
ADD . /jekyll
27+
RUN bundle install
28+
29+
ARG JEKYLL_BASEURL
30+
RUN jekyll build --baseurl $JEKYLL_BASEURL
31+
32+
####################################
33+
34+
FROM nginx:alpine
35+
36+
ARG JEKYLL_BASEURL
37+
COPY --from=builder /jekyll/_site /usr/share/nginx/html/$JEKYLL_BASEURL
38+
COPY nginx.conf /etc/nginx/nginx.conf
39+
40+
EXPOSE 80

Gemfile.lock

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ GEM
3737
jekyll (~> 3.3)
3838
jekyll-sitemap (1.2.0)
3939
jekyll (~> 3.3)
40-
jekyll-watch (2.0.0)
40+
jekyll-watch (2.1.1)
4141
listen (~> 3.0)
4242
kramdown (1.17.0)
43-
liquid (4.0.0)
43+
liquid (4.0.1)
4444
listen (3.1.5)
4545
rb-fsevent (~> 0.9, >= 0.9.4)
4646
rb-inotify (~> 0.9, >= 0.9.7)
@@ -52,7 +52,7 @@ GEM
5252
rb-fsevent (0.10.3)
5353
rb-inotify (0.9.10)
5454
ffi (>= 0.5.0, < 2)
55-
rouge (3.2.1)
55+
rouge (3.3.0)
5656
ruby_dep (1.5.0)
5757
safe_yaml (1.0.4)
5858
sass (3.6.0)
@@ -73,7 +73,7 @@ DEPENDENCIES
7373
tzinfo-data
7474

7575
RUBY VERSION
76-
ruby 2.5.1p57
76+
ruby 2.3.7p456
7777

7878
BUNDLED WITH
79-
1.16.5
79+
1.16.2

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,23 @@ cd jekyll-doc-theme
1818
bundle exec jekyll serve
1919
```
2020

21+
## Docker
22+
23+
Alternatively, you can deploy it using the multi-stage [Dockerfile](Dockerfile)
24+
that serves files from Nginx for better performance in production.
25+
26+
Build the image for your site's `JEKYLL_BASEURL`:
27+
28+
```
29+
docker build --build-arg JEKYLL_BASEURL="/" -t jekyll-doc-theme .
30+
```
31+
32+
and serve it:
33+
34+
```
35+
docker run -p 8080:80 jekyll-doc-theme
36+
```
37+
2138
## License
2239

2340
Released under [the MIT license](LICENSE).

nginx.conf

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
user nginx;
2+
worker_processes 1;
3+
4+
5+
error_log /dev/stderr warn;
6+
pid /var/run/nginx.pid;
7+
8+
9+
events
10+
{
11+
worker_connections 1024;
12+
}
13+
14+
15+
http
16+
{
17+
include /etc/nginx/mime.types;
18+
default_type application/octet-stream;
19+
20+
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
21+
'$status $body_bytes_sent "$http_referer" '
22+
'"$http_user_agent" "$http_x_forwarded_for"';
23+
24+
access_log /dev/stdout;
25+
26+
sendfile off;
27+
# tcp_nopush on;
28+
29+
keepalive_timeout 65;
30+
31+
gzip on;
32+
33+
# serve static files
34+
server
35+
{
36+
37+
location /
38+
{
39+
40+
root /usr/share/nginx/html;
41+
}
42+
}
43+
}

0 commit comments

Comments
 (0)