-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
97 lines (82 loc) · 3.62 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
############################################################
# Dockerfile for website build using jekyll, hugo, or mkdocs
############################################################
## ruby version should be compliant with netlify and github-pages
## managed build nodes, https://pages.github.com/versions/
FROM ruby:2.7.6
## For questions, visit https:
MAINTAINER "Samir B. Amin" <tweet:sbamin; sbamin.com/contact>
## NOTE: installing beta version of mkdocs-material with blog support.
LABEL version="1.5.4" \
mode="sitebuilder-1.5.4" \
description="docker image to build jekyll, hugo or mkdocs supported website" \
website="https://github.com/sbamin/sitebuilder" \
issues="https://github.com/sbamin/sitebuilder/issues"
## run apt-get non-interactive
## https://stackoverflow.com/a/56569081/1243763
ARG DEBIAN_FRONTEND=noninteractive
#### Configure locales ####
## https://github.com/jekyll/jekyll/issues/4268
RUN apt-get update && \
apt-get install -y locales && \
dpkg-reconfigure --frontend noninteractive locales && \
locale-gen C.UTF-8 && \
/usr/sbin/update-locale LANG=C.UTF-8 && \
echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen && \
locale-gen
## Set default locale
ENV LC_ALL="C.UTF-8"
ENV LANG="en_US.UTF-8"
ENV LANGUAGE="en_US.UTF-8"
ENV myhugo="0.122.0"
ENV mygo="1.22.0"
#### Jekyll ####
## Copy Gemfile ##
## This may differ based on gems and plugins used
COPY Gemfile /tmp/
RUN mkdir -p /scratch && \
mv /tmp/Gemfile /scratch/ && \
cd /scratch && \
bundle install && \
mkdir -p /web
#### Hugo, MkDocs, and theme-mkdocs-material ####
## https://github.com/squidfunk/mkdocs-material
## issue with Hash Sum mismatch
RUN rm -rf /var/lib/apt/lists/partial && \
apt-get update -o Acquire::CompressionTypes::Order::=gz && \
apt-get install -y python3-pip git && \
python3 -m pip install --upgrade pip && \
pip3 install --upgrade singledispatch nltk six && \
## force update packages if failed earlier
pip3 install --upgrade singledispatch nltk six && \
pip3 install markdown pygments fontawesome_markdown pymdown-extensions && \
pip3 install mkdocs mkdocs-material mkdocs-git-revision-date-plugin mkdocs-git-revision-date-localized-plugin mkdocs-minify-plugin mkdocs-redirects pymdown-extensions mkdocs-macros-plugin mike mkdocs-git-authors-plugin && \
## force update mkdocs env
pip3 install --upgrade markdown pygments fontawesome_markdown pymdown-extensions && \
pip3 install --upgrade mkdocs mkdocs-material mkdocs-git-revision-date-plugin mkdocs-git-revision-date-localized-plugin mkdocs-minify-plugin mkdocs-redirects pymdown-extensions mkdocs-macros-plugin mike mkdocs-git-authors-plugin && \
git config --global --add safe.directory /web
## install latest hugo extended
RUN wget https://github.com/gohugoio/hugo/releases/download/v"${myhugo}"/hugo_extended_"${myhugo}"_linux-amd64.deb && \
apt install ./hugo_extended_"${myhugo}"_linux-amd64.deb -y && \
rm hugo_extended_"${myhugo}"_linux-amd64.deb && \
wget https://go.dev/dl/go"${mygo}".linux-amd64.tar.gz && \
tar -C /usr/local -xvzf go"${mygo}".linux-amd64.tar.gz && \
mkdir -p /opt/go/bin && \
chmod 775 /opt/go && \
chmod 775 /opt/go/bin && \
apt-get install -y git && \
apt-get clean && \
rm go"${mygo}".linux-amd64.tar.gz && \
rm -rf /var/lib/apt/lists/*
ENV GOPATH="/opt/go"
## empty dir where user volume should be mounted
## to run jekyll related commands
WORKDIR /web
ENV PATH /usr/local/bundle/bin:/usr/local/bundle/gems/bin:/usr/local/go/bin:/opt/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
#### expose ports for jekyll, mkdocs, and hugo serve command ####
EXPOSE 4000
EXPOSE 8000
EXPOSE 1313
ENTRYPOINT []
CMD []
## END ##