summaryrefslogtreecommitdiff
path: root/Dockerfile
blob: 6ecf73fc17c419731ea427c74ccce1994f0ef18e (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
FROM rockylinux:9

# Install required packages
RUN dnf install -y epel-release && \
    dnf install -y \
        tmux \
        git \
        nginx \
        fcgiwrap \
        gcc \
        make \
        openssl-devel \
        zlib-devel \
        procps-ng \
        systemd-sysv && \
    dnf clean all

# Clone and build cgit
RUN git clone https://git.zx2c4.com/cgit /tmp/cgit && \
    cd /tmp/cgit && \
    git submodule init && \
    git submodule update && \
    make && \
    make install && \
    rm -rf /tmp/cgit

# Create necessary directories
RUN mkdir -p /git /var/www/htdocs/cgit && \
    chown -R nginx:nginx /var/www/htdocs/cgit && \
    chgrp -R nginx /git && \
    chmod -R g+s /git && \
    chmod -R 775 /git

# Configure cgit
RUN touch /etc/cgitrc && \
    chown nginx:nginx /etc/cgitrc && \
    chgrp nginx /etc/cgitrc && \
    chmod 664 /etc/cgitrc

# Add cgit configuration
RUN echo 'css=/cgit.css' >> /etc/cgitrc && \
    echo 'logo=/cgit.png' >> /etc/cgitrc && \
    echo 'virtual-root=/' >> /etc/cgitrc && \
    echo 'cache-size=200' >> /etc/cgitrc && \
    echo 'scan-path=/git' >> /etc/cgitrc

# Configure nginx
COPY nginx.conf /etc/nginx/nginx.conf

# Create startup script
COPY startup.sh /startup.sh
RUN chmod +x /startup.sh

# Expose port
EXPOSE 80

# Start services
CMD ["/startup.sh"]