forked from neohugo/neohugo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.extra
executable file
·91 lines (77 loc) · 2.3 KB
/
Dockerfile.extra
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
# GitHub: https://github.com/neohugo/neohugo
# Website: https://neohugo.github.io/
FROM golang:alpine AS build
# Optionally set HUGO_BUILD_TAGS to "extended" or "nodeploy" when building like so:
# docker build --build-arg HUGO_BUILD_TAGS=extended .
ENV HUGO_BUILD_TAGS=extended
ARG CGO=1
ENV CGO_ENABLED=${CGO}
ENV GOOS=linux
ENV GO111MODULE=on
WORKDIR /go/src/github.com/neohugo/neohugo
COPY . /go/src/github.com/neohugo/neohugo/
# gcc/g++ are required to build SASS libraries for extended version
RUN apk update && \
apk add --no-cache gcc g++ musl-dev && \
go install github.com/magefile/mage@latest
RUN mage neohugo && mage install
# ---
FROM node:lts-alpine
ENV MOZJPEG_VERSION="4.0.3"
LABEL description="Docker container for building static sites with the neohugo static site generator with extended."
LABEL maintainer="Prachya Saechua<blackb1rd@blackb1rd.dev>"
COPY --from=build /go/bin/neohugo /usr/bin/neohugo
# libc6-compat & libstdc++ are required for extended SASS libraries
# ca-certificates are required to fetch outside resources (like Twitter oEmbeds)
RUN apk update && \
apk add --no-cache \
bash \
ca-certificates \
exiftool \
libc6-compat \
libpng-static \
libstdc++ \
libwebp \
libwebp-tools \
openssh-client \
pngquant \
rsync \
zlib-static \
&& apk add --update --no-cache --virtual .build-deps \
autoconf \
automake \
binutils-gold \
build-base \
cmake \
curl \
g++ \
gcc \
git \
gnupg \
gzip \
libgcc \
libpng-dev \
libstdc++ \
libtool \
linux-headers \
make \
nasm \
pkgconf \
tar \
xz \
zlib-dev \
&& deluser --remove-home node \
&& addgroup -Sg 1000 neohugo \
&& adduser -Sg neohugo -u 1000 -h /src neohugo \
&& curl -L https://github.com/mozilla/mozjpeg/archive/v${MOZJPEG_VERSION}.tar.gz | tar -xz \
&& cd mozjpeg-${MOZJPEG_VERSION} \
&& cmake -DCMAKE_BUILD_TYPE=Release . \
&& make install && cd .. \
&& rm -rf mozjpeg-${MOZJPEG_VERSION} \
&& apk del .build-deps \
&& /opt/mozjpeg/bin/cjpeg -version \
&& cwebp \
&& neohugo version
WORKDIR /src
# Expose port for live server
EXPOSE 1313