aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--docker/frontend/Dockerfile39
-rwxr-xr-xdocker/frontend/cmd.sh2
-rw-r--r--docker/frontend/etc/nginx/conf.d/default.conf4
3 files changed, 32 insertions, 13 deletions
diff --git a/docker/frontend/Dockerfile b/docker/frontend/Dockerfile
index 5fb1960..337d4f6 100644
--- a/docker/frontend/Dockerfile
+++ b/docker/frontend/Dockerfile
@@ -1,19 +1,38 @@
-FROM nginx:1
-
-RUN export DEBIAN_FRONTEND=noninteractive && \
- runtime_deps='cgit cmark-gfm fcgiwrap tini' && \
- apt-get update && \
- apt-get install -y --no-install-recommends $runtime_deps && \
- # Install the latest Pygments (so that it would highlight CMakeLists.txt, etc.):
- apt-get install -y --no-install-recommends python3-pip && \
- pip3 install --no-cache-dir pygments~=2.0 && \
+FROM nginx:1-alpine AS base
+
+FROM base AS builder
+
+# Install cmark-gfm:
+ARG CMARK_GFM_VERSION=0.29.0.gfm.3
+ADD ["https://github.com/github/cmark-gfm/archive/refs/tags/$CMARK_GFM_VERSION.zip", "/"]
+
+RUN apk add --no-cache cmake g++ make python2 py3-pip && \
+ 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 && \
+ pip install --no-cache-dir --target=/pygments "pygments$PYGMENTS_VERSION"
+
+FROM base
+
+RUN apk add --no-cache bash cgit fcgiwrap 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 ["/usr/bin/tini", "--"]
+ENTRYPOINT ["/sbin/tini", "--"]
CMD ["/cmd.sh"]
diff --git a/docker/frontend/cmd.sh b/docker/frontend/cmd.sh
index 0795d4c..25ea3c7 100755
--- a/docker/frontend/cmd.sh
+++ b/docker/frontend/cmd.sh
@@ -11,6 +11,6 @@ spawn-fcgi \
-M 0755 \
-F 10 \
-s /run/fcgiwrap.sock \
- /usr/sbin/fcgiwrap
+ /usr/bin/fcgiwrap
exec nginx -g 'daemon off;'
diff --git a/docker/frontend/etc/nginx/conf.d/default.conf b/docker/frontend/etc/nginx/conf.d/default.conf
index 1fcbf13..dc27e85 100644
--- a/docker/frontend/etc/nginx/conf.d/default.conf
+++ b/docker/frontend/etc/nginx/conf.d/default.conf
@@ -7,7 +7,7 @@ server {
include fastcgi_params;
fastcgi_pass unix:/run/fcgiwrap.sock;
- fastcgi_param SCRIPT_FILENAME /usr/lib/cgit/cgit.cgi;
+ fastcgi_param SCRIPT_FILENAME /usr/share/webapps/cgit/cgit.cgi;
# This looks stupid. Can I substitute any variable for $fastcgi_path_info?
fastcgi_split_path_info ^(/?)(.+)$;
@@ -15,6 +15,6 @@ server {
}
location /cgit/ {
- alias /usr/share/cgit/;
+ alias /usr/share/webapps/cgit/;
}
}