-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
77 lines (59 loc) · 1.11 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
FROM ruby:3.3-bookworm AS base
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
WORKDIR /theme
COPY . .
# Create site
RUN <<_SITE
#!/bin/bash
set -e
TMPDIR=/tmp/site
base_dirs=(
./third-party/beautiful-jekyll
./
)
targets=(
*.gemspec
_data
_includes
_layouts
_sass
assets
404.html
_config_theme.yml
favicon.ico
feed.xml
Gemfile
staticman.yml
tags.html
)
for base_dir in "${base_dirs[@]}"; do
for target in "${targets[@]}"; do
if [ -e "$base_dir/$target" ]; then
cp -rf "$base_dir/$target" ${TMPDIR}/
fi
done
done
cp -RTf ./ ${TMPDIR}/
_SITE
FROM base AS build
RUN <<_DEPS
#!/bin/bash
set -e
apt-get update -qq
apt-get install -y --no-install-recommends \
build-essential
apt-get clean
rm -rf /var/lib/apt/lists/*
_DEPS
WORKDIR /app
COPY --from=base /tmp/site .
# Install the gems specified in the Gemfile
RUN <<_SETUP
#!/bin/bash
set -e
bundle install
_SETUP
# Expose the port that Jekyll will run on
EXPOSE 4000
# Command to build and serve the Jekyll site
CMD ["bundle", "exec", "jekyll", "serve", "--future", "--trace", "--config", "_config_theme.yml,_config_local.yml"]