-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
86 lines (64 loc) · 2.12 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
ARG HUGO_VERSION=0.108.0
ARG HUGO_BUILD_TAGS=extended
ARG GO_VERSION=1.19
FROM golang:${GO_VERSION}-bullseye AS build
ARG HUGO_VERSION
ARG HUGO_BUILD_TAGS
ARG CGO=1
ENV CGO_ENABLED=${CGO}
ENV GOOS=linux
ENV GO111MODULE=on
WORKDIR /go/src/github.com/gohugoio/hugo
# gcc/g++ are required to build SASS libraries for extended version
RUN apt-get install \
gcc \
g++ \
git
# clone source from Git repo:
RUN git clone \
--branch "v${HUGO_VERSION}" \
--single-branch \
--depth 1 \
https://github.com/gohugoio/hugo.git ./
# https://github.com/gohugoio/hugo/commit/241481931f5f5f2803cd4be519936b26d8648dfd
RUN go build -v -ldflags "-X github.com/gohugoio/hugo/common/hugo.vendorInfo=docker" -tags "$HUGO_BUILD_TAGS" && \
mv ./hugo /go/bin/hugo
FROM debian:bullseye
ARG HUGO_VERSION
# https://github.com/sass/dart-sass-embedded/releases
ARG DART_SASS_VERSION=1.56.1
LABEL version="${HUGO_VERSION}"
LABEL repository="https://github.com/openaq/hugo-docker"
LABEL homepage="https://openaq.org/"
LABEL org.opencontainers.image.source=https://github.com/openaq/hugo-docker
LABEL org.opencontainers.image.description="image for building hugo with dart-sass-embedded"
LABEL org.opencontainers.image.licenses=MIT
COPY --from=build /go/bin/hugo /usr/bin/hugo
RUN apt-get update && \
apt-get install -y \
curl && \
curl -fsSL https://deb.nodesource.com/setup_lts.x | bash -
RUN apt-get update && \
apt-get install -y \
wget \
tzdata \
git \
nodejs \
golang && \
npm install --global --production \
yarn \
postcss \
postcss-cli \
autoprefixer \
@babel/core \
@babel/cli && \
npm cache clean --force && \
wget -O sass-embedded.tar.gz https://github.com/sass/dart-sass-embedded/releases/download/${DART_SASS_VERSION}/sass_embedded-${DART_SASS_VERSION}-linux-x64.tar.gz && \
tar xf sass-embedded.tar.gz && \
mv ./sass_embedded/dart-sass-embedded /usr/bin/ && \
chmod 755 /usr/bin/dart-sass-embedded && \
rm -rf sass-embedded.tar.gz sass_embedded
VOLUME /src
WORKDIR /src
EXPOSE 1313
ENTRYPOINT ["hugo"]