aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsaturneric <[email protected]>2025-11-02 00:28:01 +0000
committersaturneric <[email protected]>2025-11-02 00:28:01 +0000
commit2f361a0e62fefd2ddcbeb4508acaf7dba30bb6f2 (patch)
tree8dd1bd752aa43bdace4045e2c76cbb83a74581b8
parentfeat(docker): add initial `Dockerfile` for build setup (diff)
downloadcgit-2f361a0e62fefd2ddcbeb4508acaf7dba30bb6f2.tar.gz
cgit-2f361a0e62fefd2ddcbeb4508acaf7dba30bb6f2.zip
feat(docker): split build and runtime stages
* Separate build and runtime environments to streamline image layers * Add missing dev dependencies for building and runtime dependencies for serving * Use `lighttpd` as the runtime web server and move configuration files * Pass custom build option to `make` for improved compatibility
-rw-r--r--Dockerfile19
1 files changed, 15 insertions, 4 deletions
diff --git a/Dockerfile b/Dockerfile
index 43b81dc..b360923 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,9 +1,20 @@
-FROM alpine:latest as builder
+FROM alpine:latest AS builder
COPY . /app
-RUN apk --no-cache add git gcc make openssl libzip lua5.4 nginx && \
+RUN apk --no-cache add libc-dev git gcc make openssl-dev libzip lua5.4 zlib-dev gettext-dev && \
cd /app && \
git submodule update --init --recursive && \
- make && \
- make install \ No newline at end of file
+ make NO_REGEX=NeedsStartEnd install
+
+FROM alpine:latest AS runtime
+
+COPY --from=builder /var/www/htdocs/cgit /usr/share/webapps/cgit
+
+RUN apk --no-cache add lighttpd
+
+COPY lighttpd.conf /etc/lighttpd/lighttpd.conf
+COPY cgitrc /etc/cgitrc
+COPY cgitrepos /etc/cgitrepos
+
+ENTRYPOINT [ "lighttpd", "-D", "-f", "/etc/lighttpd/lighttpd.conf" ] \ No newline at end of file