stagit

static git page generator
git clone https://git.awy.one/stagit
Log | Files | Refs | README | LICENSE

Dockerfile (2540B) - raw


 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
FROM alpine:latest AS build

RUN apk add --no-cache \
      build-base \
      git \
      go \
      libgit2-dev \
      md4c-dev

RUN git clone https://github.com/alecthomas/chroma /tmp/chroma && \
    cd /tmp/chroma && \
    git checkout v2.14.0 && \
    cd cmd/chroma && \
    CGO_ENABLED=0 go build -o /tmp/install/usr/local/bin/chroma-v2 .

RUN git clone https://codeberg.org/awy/stagit /tmp/stagit && \
    cd /tmp/stagit && \
    make CFLAGS="-O2" && \
    make install DESTDIR=/tmp/install

FROM alpine:latest

RUN apk add --no-cache \
      git \
      git-daemon \
      openssh-server \
      libgit2 \
      md4c \
      fcgiwrap \
      nginx \
      spawn-fcgi \
      su-exec \
      ca-certificates

RUN addgroup -S git && \
      adduser -S -G git -h /home/git -s /usr/bin/git-shell git && \
      sed -i 's/^git:!:/git:*:/' /etc/shadow

RUN mkdir -p /home/git/.ssh && \
      mkdir -p /home/git/git-shell-commands && \
      chmod 700 /home/git/.ssh

RUN mkdir -p /home/git/hooks
COPY docker/git-scripts/create /home/git/git-shell-commands
COPY docker/git-scripts/rebuild /home/git/git-shell-commands
RUN chown -R git:git /home/git

COPY --from=build /tmp/install/usr/local/bin/stagit /usr/local/bin/stagit
COPY --from=build /tmp/install/usr/local/bin/stagit-index /usr/local/bin/stagit-index
COPY --from=build /tmp/install/usr/local/bin/stagit-gen-index /usr/local/bin/stagit-gen-index
COPY --from=build /tmp/install/usr/local/bin/stagit-newrepo /usr/local/bin/stagit-newrepo
COPY --from=build /tmp/install/usr/local/bin/stagit-rebuild-all /usr/local/bin/stagit-rebuild-all
COPY --from=build /tmp/install/usr/local/bin/chroma-v2 /usr/local/bin/chroma-v2
COPY docker/sshd_config /etc/ssh/sshd_config

RUN mkdir -p \
      /srv/git/repos \
      /srv/git/repos/template \
      /var/www/git \
      /run/nginx \
      /run/fcgiwrap && \
    chown -R git:git /srv/git /var/www/git /run/fcgiwrap && \
    chmod +x \
      /usr/local/bin/stagit \
      /usr/local/bin/stagit-index \
      /usr/local/bin/stagit-gen-index \
      /usr/local/bin/stagit-newrepo \
      /usr/local/bin/stagit-rebuild-all \
      /usr/local/bin/chroma-v2

COPY docker/config.rc /home/git/config.rc
COPY docker/post-receive /home/git/hooks/post-receive
COPY docker/nginx.conf /etc/nginx/http.d/default.conf
COPY docker/entrypoint.sh /entrypoint.sh
COPY docker/style.css /var/www/git/style.css

RUN chown git:git \
      /home/git/config.rc \
      /var/www/git/style.css && \
    chmod +x \
      /entrypoint.sh

EXPOSE 80

CMD ["/entrypoint.sh"]