summaryrefslogtreecommitdiff
path: root/Dockerfile
blob: 2d73b0ab4bc20ccef942934b956ea7d28775d6b0 (plain)
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
FROM debian:stable-slim AS build_stage

ARG CGIT_VERSION="master"

RUN apt-get update && apt-get install -y --no-install-recommends \
    build-essential \
    git \
    liblua5.1-dev \
    zlib1g-dev \
    libssl-dev \
    gettext \
    python3 \
    python3-docutils \
    python3-markdown \
    python3-pygments \
    ca-certificates \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /opt
RUN git clone https://git.zx2c4.com/cgit
WORKDIR /opt/cgit
RUN git checkout ${CGIT_VERSION} \
    && git submodule init \
    && git submodule update

COPY cgit.conf .

RUN make -j7 && make install

FROM debian:stable-slim AS wwwgit

RUN apt-get update && apt-get install -y --no-install-recommends \
    nginx-light \
    fcgiwrap \
    git \
    gettext-base \
    python3 \
    python3-docutils \
    python3-markdown \
    python3-pygments \
    tini \
    && rm -rf /var/lib/apt/lists/*

COPY --from=build_stage /var/www/html/cgit /var/www/html/cgit

RUN mkdir -p /var/lib/git/repositories \
    && chown -R www-data:www-data /var/www/html/cgit \
    && chown -R www-data:www-data /var/lib/git

RUN rm /etc/nginx/sites-enabled/default

COPY cgit.nginx.conf /etc/nginx/sites-available/cgit.conf
RUN ln -s /etc/nginx/sites-available/cgit.conf /etc/nginx/sites-enabled/cgit.conf

COPY cgitrc /var/www/html/cgit/cgitrc

COPY entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/entrypoint.sh

RUN mkdir /run/sock
RUN chown -R www-data:www-data /run/sock

EXPOSE 80
ENTRYPOINT ["/usr/bin/tini", "--", "/usr/local/bin/entrypoint.sh"]