Intial release 0.0.1
This commit is contained in:
		
							parent
							
								
									48923386b3
								
							
						
					
					
						commit
						b4d77a8ff6
					
				
							
								
								
									
										9
									
								
								Caddyfile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								Caddyfile
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,9 @@
 | 
				
			|||||||
 | 
					{
 | 
				
			||||||
 | 
						order gitea before file_server
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					:3003
 | 
				
			||||||
 | 
					gitea {
 | 
				
			||||||
 | 
						token  {$GITEA_ACCESS_TOKEN} # Settings > Applications > Generate Token
 | 
				
			||||||
 | 
						server {$GITEA_HOST}   # https://yourgitea.yourdomain.com
 | 
				
			||||||
 | 
						domain {$PAGES_DOMAIN} #             pages.yourdomain.com
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										14
									
								
								Dockerfile
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								Dockerfile
									
									
									
									
									
								
							@ -1,8 +1,16 @@
 | 
				
			|||||||
FROM caddy:2.6-builder-alpine AS builder
 | 
					FROM caddy:2.8.4-builder-alpine AS builder
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					COPY pkg/gitea/* /module/gitea-pages/pkg/gitea/
 | 
				
			||||||
 | 
					COPY gitea-pages.go go.mod go.sum /module/gitea-pages/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
RUN xcaddy build \
 | 
					RUN xcaddy build \
 | 
				
			||||||
    --with github.com/42wim/caddy-gitea@v0.0.3
 | 
					    --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
 | 
				
			||||||
 | 
					
 | 
				
			||||||
FROM caddy:2.6.2
 | 
					FROM caddy:2.8.4
 | 
				
			||||||
 | 
					
 | 
				
			||||||
COPY --from=builder /usr/bin/caddy /usr/bin/caddy
 | 
					COPY --from=builder /usr/bin/caddy /usr/bin/caddy
 | 
				
			||||||
 | 
					COPY Caddyfile /etc/caddy/Caddyfile 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					EXPOSE 3003/tcp
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										2
									
								
								LICENSE
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								LICENSE
									
									
									
									
									
								
							@ -186,7 +186,7 @@
 | 
				
			|||||||
      same "printed page" as the copyright notice for easier
 | 
					      same "printed page" as the copyright notice for easier
 | 
				
			||||||
      identification within third-party archives.
 | 
					      identification within third-party archives.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   Copyright [yyyy] [name of copyright owner]
 | 
					   Copyright 2023 https://github.com/42wim
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   Licensed under the Apache License, Version 2.0 (the "License");
 | 
					   Licensed under the Apache License, Version 2.0 (the "License");
 | 
				
			||||||
   you may not use this file except in compliance with the License.
 | 
					   you may not use this file except in compliance with the License.
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										75
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										75
									
								
								README.md
									
									
									
									
									
								
							@ -1,9 +1,8 @@
 | 
				
			|||||||
# caddy-gitea
 | 
					# gitea-pages
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[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).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
This allows you to have github pages (with more features) in Gitea.
 | 
					The project aims to have Github Pages in Gitea. For doing so it relies on a wildcard CNAME DNS entry to the gitea host.
 | 
				
			||||||
This also requires you to setup a wildcard CNAME to your gitea host.
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
For now markdown files (with `.md` extension) will also be automatically generated to HTML.
 | 
					For now markdown files (with `.md` extension) will also be automatically generated to HTML.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -18,6 +17,7 @@ For now markdown files (with `.md` extension) will also be automatically generat
 | 
				
			|||||||
            - [any repo with configurable allowed branch/tag/commits](#any-repo-with-configurable-allowed-branchtagcommits)
 | 
					            - [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)
 | 
					            - [any repo with all branches/tags/commits exposed](#any-repo-with-all-branchestagscommits-exposed)
 | 
				
			||||||
    - [Building caddy](#building-caddy)
 | 
					    - [Building caddy](#building-caddy)
 | 
				
			||||||
 | 
					    - [Integration & deployment](#Integration with Gitea)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<!-- /TOC -->
 | 
					<!-- /TOC -->
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -114,7 +114,70 @@ e.g. we'll use the `yourrepo` repo in the `yourorg` org and there is a `file.htm
 | 
				
			|||||||
As this is a 3rd party plugin you'll need to build caddy (or use the binaries).
 | 
					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 go1.19 installed.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```go
 | 
					```bash
 | 
				
			||||||
go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest #this will install xcaddy in ~/go/bin
 | 
					go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest #this will install xcaddy in ~/go/bin
 | 
				
			||||||
~/go/bin/xcaddy build --with github.com/42wim/caddy-gitea@v0.0.4
 | 
					
 | 
				
			||||||
 | 
					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
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## Integration with Gitea
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Afther the release is done, `gitea-pages` docker image shall be availvable at the [Docker Hub](https://hub.docker.com/repository/docker/djmil/gitea-pages/general)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```yaml
 | 
				
			||||||
 | 
					version: "3"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					networks:
 | 
				
			||||||
 | 
					  gitea:
 | 
				
			||||||
 | 
					    external: false
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					services:
 | 
				
			||||||
 | 
					  gitea:
 | 
				
			||||||
 | 
					    image: gitea/gitea:1.22.0
 | 
				
			||||||
 | 
					    restart: always
 | 
				
			||||||
 | 
					    environment:
 | 
				
			||||||
 | 
					      - USER_UID=1000
 | 
				
			||||||
 | 
					      - USER_GID=1000
 | 
				
			||||||
 | 
					      - GITEA__database__DB_TYPE=mysql
 | 
				
			||||||
 | 
					      - GITEA__database__HOST=db:3306
 | 
				
			||||||
 | 
					      - GITEA__database__NAME=gitea
 | 
				
			||||||
 | 
					      - GITEA__database__USER=gitea
 | 
				
			||||||
 | 
					      - GITEA__database__PASSWD=gitea
 | 
				
			||||||
 | 
					    networks:
 | 
				
			||||||
 | 
					      - gitea
 | 
				
			||||||
 | 
					    volumes:
 | 
				
			||||||
 | 
					      - ./gitea:/data
 | 
				
			||||||
 | 
					      - /etc/timezone:/etc/timezone:ro
 | 
				
			||||||
 | 
					      - /etc/localtime:/etc/localtime:ro
 | 
				
			||||||
 | 
					    ports:
 | 
				
			||||||
 | 
					      - "3000:3000"
 | 
				
			||||||
 | 
					    depends_on:
 | 
				
			||||||
 | 
					      - db
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  db:
 | 
				
			||||||
 | 
					    image: mysql:8
 | 
				
			||||||
 | 
					    restart: always
 | 
				
			||||||
 | 
					    environment:
 | 
				
			||||||
 | 
					      - MYSQL_ROOT_PASSWORD=gitea
 | 
				
			||||||
 | 
					      - MYSQL_USER=gitea
 | 
				
			||||||
 | 
					      - MYSQL_PASSWORD=gitea
 | 
				
			||||||
 | 
					      - MYSQL_DATABASE=gitea
 | 
				
			||||||
 | 
					    networks:
 | 
				
			||||||
 | 
					      - gitea
 | 
				
			||||||
 | 
					    volumes:
 | 
				
			||||||
 | 
					      - ./mysql:/var/lib/mysql
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  pages:
 | 
				
			||||||
 | 
					    image: djmil/gitea-pages:0.0.1
 | 
				
			||||||
 | 
					    restart: always
 | 
				
			||||||
 | 
					    environment:
 | 
				
			||||||
 | 
					      - GITEA_HOST=http://gitea:3000
 | 
				
			||||||
 | 
					      - PAGES_DOMAIN=pages.djmil.dev
 | 
				
			||||||
 | 
					    networks:
 | 
				
			||||||
 | 
					      - gitea
 | 
				
			||||||
 | 
					    ports:
 | 
				
			||||||
 | 
					      - "3003:3003"
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
@ -5,7 +5,7 @@ import (
 | 
				
			|||||||
	"net/http"
 | 
						"net/http"
 | 
				
			||||||
	"strings"
 | 
						"strings"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"github.com/42wim/caddy-gitea/pkg/gitea"
 | 
						"gitea.djmil.dev/goland/gitea-pages/pkg/gitea"
 | 
				
			||||||
	"github.com/caddyserver/caddy/v2"
 | 
						"github.com/caddyserver/caddy/v2"
 | 
				
			||||||
	"github.com/caddyserver/caddy/v2/caddyconfig/caddyfile"
 | 
						"github.com/caddyserver/caddy/v2/caddyconfig/caddyfile"
 | 
				
			||||||
	"github.com/caddyserver/caddy/v2/caddyconfig/httpcaddyfile"
 | 
						"github.com/caddyserver/caddy/v2/caddyconfig/httpcaddyfile"
 | 
				
			||||||
							
								
								
									
										2
									
								
								go.mod
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								go.mod
									
									
									
									
									
								
							@ -1,4 +1,4 @@
 | 
				
			|||||||
module github.com/42wim/caddy-gitea
 | 
					module gitea-pages
 | 
				
			||||||
 | 
					
 | 
				
			||||||
go 1.19
 | 
					go 1.19
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										39
									
								
								make-release.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										39
									
								
								make-release.sh
									
									
									
									
									
										Executable file
									
								
							@ -0,0 +1,39 @@
 | 
				
			|||||||
 | 
					#!/bin/bash
 | 
				
			||||||
 | 
					set -e
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					usage="$(basename "$0") [-h] [-t RELEASE_VERSION ]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The script compiles Caddy server with GiteaPages plugin, and publishes the resulting image 
 | 
				
			||||||
 | 
					to the https://hub.docker.com/u/djmil
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Where:
 | 
				
			||||||
 | 
					    -t  RELEASE_VERSION
 | 
				
			||||||
 | 
					        A major.minor.patch tag for the image being publisdhed.
 | 
				
			||||||
 | 
					"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					tag=''
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					while getopts ht: flag 
 | 
				
			||||||
 | 
					do
 | 
				
			||||||
 | 
					    case "${flag}" in
 | 
				
			||||||
 | 
					        t) tag=${OPTARG};;
 | 
				
			||||||
 | 
					        h) echo "$usage"; exit 0;;
 | 
				
			||||||
 | 
					        *) echo "$usage" >&2; exit 1;;
 | 
				
			||||||
 | 
					    esac
 | 
				
			||||||
 | 
					done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if [ ! "$tag" ]; then
 | 
				
			||||||
 | 
					        echo 'Missing: -t RELEASE_VERSION' >&2
 | 
				
			||||||
 | 
					        exit 1
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					echo "Tag: $tag";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					docker build --tag djmil/gitea-pages:$tag .
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#git tag
 | 
				
			||||||
 | 
					#git push tag
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					docker login --username djmil #--password-stdin
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					docker push djmil/gitea-pages:$tag
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user