aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/docker/frontend/Dockerfile
blob: ef76fc67c8c5239ed3881db0c0c94cc62c26ff4a (plain) (blame)
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
FROM alpine:3.16 AS base

FROM base AS builder

# Install cmark-gfm:
ARG CMARK_GFM_VERSION=0.29.0.gfm.6
ADD ["https://github.com/github/cmark-gfm/archive/refs/tags/$CMARK_GFM_VERSION.zip", "/"]

RUN apk add --no-cache cmake g++ make python3 && \
    ln -sf /usr/bin/python3 /usr/bin/python
RUN unzip -- "$CMARK_GFM_VERSION.zip" && \
    cd -- "cmark-gfm-$CMARK_GFM_VERSION" && \
    make INSTALL_PREFIX=/cmark-gfm && \
    make test && \
    make install

# Install the latest Pygments (so that it would highlight CMakeLists.txt, etc.):
ARG PYGMENTS_VERSION=~=2.0

RUN apk add --no-cache py3-pip && \
    pip3 install --no-cache-dir --target=/pygments "pygments$PYGMENTS_VERSION"

FROM base

RUN apk add --no-cache cgit dash fcgiwrap nginx python3 spawn-fcgi tini && \
    # Replace the theme with the one I like better:
    grep -q -F -- "style='pastie'" /usr/lib/cgit/filters/syntax-highlighting.py && \
    sed -i -e "s/style='pastie'/style='vs'/" -- /usr/lib/cgit/filters/syntax-highlighting.py

COPY --from=builder ["/cmark-gfm", "/usr/local/"]
COPY --from=builder ["/pygments", "/pygments/"]
ENV PYTHONPATH="/pygments"

COPY ["etc/", "/etc/"]
COPY ["usr/", "/usr/"]
COPY ["cmd.sh", "/"]

ENTRYPOINT ["/sbin/tini", "--"]
CMD ["/cmd.sh"]