forked from rgielen/hugo-ubuntu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
157 lines (139 loc) · 4.55 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# syntax = docker/dockerfile:1.0-experimental
FROM ubuntu:bionic-20200403
# Use the Sass/SCSS enabled variant by default
ARG HUGO_TYPE=_extended
ARG HUGO_VERSION=0.71.1
ARG HUGO_DOWNLOAD_URL="https://github.com/gohugoio/hugo/releases/download/v$HUGO_VERSION/hugo"$HUGO_TYPE"_"$HUGO_VERSION"_Linux-64bit.tar.gz"
ARG MINIFY_DOWNLOAD_URL="https://bin.equinox.io/c/dhgbqpS8Bvy/minify-stable-linux-amd64.tgz"
ARG asciidoctor_version=2.0.10
ARG asciidoctor_confluence_version=0.0.2
ARG asciidoctor_pdf_version=1.5.2
ARG asciidoctor_diagram_version=2.0.1
ARG asciidoctor_epub3_version=1.5.0.alpha.13
ARG asciidoctor_mathematical_version=0.3.1
ARG asciidoctor_revealjs_version=4.0.1
ARG kramdown_asciidoc_version=1.0.1
ARG BUILD_DATE
ARG VCS_REF
LABEL maintainer="Rainer Hermanns <rainerh@gmail.com>" \
org.label-schema.build-date=$BUILD_DATE \
org.label-schema.docker.dockerfile="/Dockerfile" \
org.label-schema.license="MIT" \
org.label-schema.name="Docker Hugo (extended) based on Ubuntu" \
org.label-schema.url="https://github.com/rainerh/hugo-asciidoctor/" \
org.label-schema.vcs-ref=$VCS_REF \
org.label-schema.vcs-url="https://github.com/rainerh/hugo-asciidoctor.git" \
org.label-schema.vcs-type="Git"
# Install development essentials
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
apt-transport-https \
bash \
bash-completion \
bison \
build-essential \
curl \
cmake \
flex \
fonts-liberation2 \
git \
gnupg \
graphviz \
imagemagick \
inotify-tools \
libreadline-dev \
libcairo2-dev \
libghc-pango-dev \
libgdk-pixbuf2.0-dev \
libpango-1.0-0 \
libpango1.0-dev \
libpangocairo-1.0-0 \
libxml2 \
libxml2-dev \
lsb-release \
make \
ttf-dejavu \
openjdk-11-jre \
plantuml \
python3-all \
python3-setuptools \
python3-dev \
python3-pip \
ruby \
ruby-dev \
ruby-pango \
tzdata \
wget \
zlibc \
&& curl -sL https://deb.nodesource.com/setup_12.x | bash - \
&& apt install -y nodejs \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN npm install -g postcss-cli autoprefixer \
&& npm install -g yarn
# Setup user and group
ENV HUGO_USER=hugo \
HUGO_UID=1000 \
HUGO_GID=1000 \
HUGO_HOME=/hugo
RUN addgroup --system --gid $HUGO_GID $HUGO_USER \
&& adduser --system \
--gid $HUGO_GID \
--home $HUGO_HOME \
--uid $HUGO_UID \
$HUGO_USER
# Installing Ruby Gems needed in the image
# including asciidoctor itself
RUN gem install --no-document \
rake \
bundler \
"asciidoctor:${asciidoctor_version}" \
"asciidoctor-confluence:${asciidoctor_confluence_version}" \
"asciidoctor-diagram:${asciidoctor_diagram_version}" \
"asciidoctor-epub3:${asciidoctor_epub3_version}" \
"asciidoctor-mathematical:${asciidoctor_mathematical_version}" \
asciimath \
"asciidoctor-pdf:${asciidoctor_pdf_version}" \
"asciidoctor-revealjs:${asciidoctor_revealjs_version}" \
pygments.rb \
rouge \
coderay \
epubcheck-ruby:4.2.2.0 \
haml \
"kramdown-asciidoc:${kramdown_asciidoc_version}" \
rouge \
slim \
thread_safe \
tilt \
kindlegen:3.0.4
# Installing Python dependencies for additional
# functionalities as diagrams or syntax highligthing
RUN pip3 install --no-cache --upgrade pip setuptools wheel \
&& if [ ! -e /usr/bin/pip ]; then ln -s pip3 /usr/bin/pip ; fi \
&& pip install --no-cache-dir \
actdiag \
'blockdiag[pdf]' \
nwdiag \
Pygments \
seqdiag
# Add preconfigured asciidoctor wrapper to include custom extensions
COPY asciidoctor /usr/local/sbin
# Install HUGO
RUN mkdir -p ${HUGO_HOME} \
&& mkdir -p /usr/local/src \
&& cd /usr/local/src \
&& curl -L "$HUGO_DOWNLOAD_URL" | tar -xz \
&& mv hugo /usr/local/bin/hugo \
&& curl -L "$MINIFY_DOWNLOAD_URL" | tar -xz \
&& mv minify /usr/local/bin/
# Cleanup
RUN apt-get remove -y curl wget gnupg apt-transport-https lsb-release \
&& apt-get clean \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /tmp/*
USER $HUGO_USER
WORKDIR $HUGO_HOME
VOLUME ${HUGO_HOME}
ENV PATH=${HUGO_HOME}:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
CMD ["hugo","server","--bind","0.0.0.0"]