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 \ curl \ && 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 COPY static /var/www/html/cgit/static EXPOSE 80 ENTRYPOINT ["/usr/bin/tini", "--", "/usr/local/bin/entrypoint.sh"]