From b0629205c198d85cfcf4534cb3a50a76bf5cc906 Mon Sep 17 00:00:00 2001 From: djmil Date: Thu, 22 Aug 2024 23:00:06 +0200 Subject: [PATCH] Update README This commit closes #2 - Add list of similar projects - Build locally - Docker builder container --- README.md | 55 +++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 39 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 89fb285..bcb3802 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # gitea-pages -Fork of the [caddy-gitea](https://github.com/42wim/caddy-gitea) project: [Gitea](https://gitea.io) plugin for [Caddy v2](https://github.com/caddyserver/caddy). +Fork of the [caddy-gitea](https://github.com/42wim/caddy-gitea) project: [Gitea](https://gitea.io) plugin for [Caddy v2](https://github.com/caddyserver/caddy). List of [alternatives](https://docs.gitea.com/awesome#web-hosting). The project aims to have Github Pages in Gitea. For doing so it relies on a wildcard CNAME DNS entry to the gitea host. @@ -8,16 +8,16 @@ For now markdown files (with `.md` extension) will also be automatically generat -- [caddy-gitea](#caddy-gitea) - - [Getting started](#getting-started) - - [Caddy config](#caddy-config) - - [DNS config](#dns-config) - - [Gitea config](#gitea-config) - - [gitea-pages repo](#gitea-pages-repo) - - [any repo with configurable allowed branch/tag/commits](#any-repo-with-configurable-allowed-branchtagcommits) - - [any repo with all branches/tags/commits exposed](#any-repo-with-all-branchestagscommits-exposed) - - [Building caddy](#building-caddy) - - [Integration with Gitea](#integration-with-gitea) +- [Getting started](#getting-started) + - [Caddy config](#caddy-config) + - [DNS config](#dns-config) + - [Gitea config](#gitea-config) + - [gitea-pages repo](#gitea-pages-repo) + - [any repo with configurable allowed branch/tag/commits](#any-repo-with-configurable-allowed-branchtagcommits) + - [any repo with all branches/tags/commits exposed](#any-repo-with-all-branchestagscommits-exposed) +- [Building caddy with plugin](#building-caddy) + - [Build locally](#build-with-locally-cloned-plugin-sources) +- [Integration with Gitea](#integration-with-gitea) @@ -112,15 +112,38 @@ e.g. we'll use the `yourrepo` repo in the `yourorg` org and there is a `file.htm ## Building caddy As this is a 3rd party plugin you'll need to build caddy (or use the binaries). -To build with this plugin you'll need to have go1.19 installed. +To build with this plugin you'll need to have `Golang v1.19` installed. Basic idea: ```bash -go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest #this will install xcaddy in ~/go/bin +# 1 install xcaddy in ~/go/bin +go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest +# 2 build caddy binary with the latest plugin version xcaddy build \ - --with gitea.djmil.dev/goland/gitea-pages \ - --replace gitea.djmil.dev/goland/gitea-pages=/module/gitea-pages \ - --replace gitea.djmil.dev/goland/gitea-pages/pkg/gitea=/module/gitea-pages/pkg/gitea + --with gitea.djmil.dev/djmil/gitea-pages +``` + +### Build with locally cloned plugin sources + +Also Docker builder image can be used to build caddy alongside locally cloned git repo of a plugin: + +```Dockerfile +FROM caddy:2.8.4-builder-alpine AS builder + +COPY gitea-pages.go go.mod go.sum /module/gitea-pages/ +COPY pkg/gitea/* /module/gitea-pages/pkg/gitea/ + +RUN xcaddy build \ + --with gitea.djmil.dev/djmil/gitea-pages \ + --replace gitea.djmil.dev/djmil/gitea-pages=/module/gitea-pages \ + --replace gitea.djmil.dev/djmil/gitea-pages/pkg/gitea=/module/gitea-pages/pkg/gitea + +FROM caddy:2.8.4 + +COPY --from=builder /usr/bin/caddy /usr/bin/caddy +COPY Caddyfile /etc/caddy/Caddyfile + +EXPOSE 3003/tcp ``` ## Integration with Gitea