feat: fdroid

This commit is contained in:
ange 2024-02-05 00:05:18 +01:00
parent 08b410b586
commit ccb7cf6502
Signed by: ange
GPG Key ID: 9E0C4157BB7BEB1D
9 changed files with 112 additions and 0 deletions

7
fdroid/.env Normal file
View File

@ -0,0 +1,7 @@
BASE_URL=fdroid.ovh.maby.dev
EMAIL=ange@duhayon.com
REPO_NAME=fdroid
PUID=1000
PGID=1000

7
fdroid/Dockerfile Normal file
View File

@ -0,0 +1,7 @@
FROM docker.io/nginx:latest
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
fdroidserver \
&& rm -rf /var/lib/apt/lists/*
COPY entrypoint.sh /docker-entrypoint.d/99-init-fdroid.sh
COPY default.conf /etc/nginx/conf.d/

38
fdroid/compose.yaml Normal file
View File

@ -0,0 +1,38 @@
---
services:
install_site:
build: install_site
environment:
- BASE_URL
- EMAIL
volumes:
- ./nginx.conf:/web/fdroid.conf
- sites:/sites/
- certs:/etc/letsencrypt/
- certbotroot:/var/www/certbot/
- /var/run/docker.sock:/var/run/docker.sock
fdroid:
build: .
restart: unless-stopped
environment:
- BASE_URL
- REPO_NAME
- PUID
- PGID
volumes:
- ./repo/:/repo/
networks:
- nginx
volumes:
sites:
external: true
certs:
external: true
certbotroot:
external: true
networks:
nginx:
external: true

14
fdroid/default.conf Normal file
View File

@ -0,0 +1,14 @@
server {
listen 80;
server_name localhost;
location / {
return 301 /repo/;
}
location /repo/ {
root /repo;
index index.html;
}
}

16
fdroid/entrypoint.sh Executable file
View File

@ -0,0 +1,16 @@
#!/bin/bash
(cd /repo/
fdroid init
sed -i \
-e "/repo_url/s .* repo_url:\ https://$BASE_URL/repo " \
-e "/repo_name/s .* repo_name:\ \"$REPO_NAME\" " \
config.yml
fdroid update -c
)
if [ -n "$PUID" ]; then
chown -R "$PUID:$PGID" /repo/
fi

5
fdroid/init.sh Normal file
View File

@ -0,0 +1,5 @@
#!/bin/bash -e
docker run --rm -v "$PWD/repo/:/repo/" \
'registry.gitlab.com/fdroid/docker-executable-fdroidserver:master' \
init -v

1
fdroid/install_site Symbolic link
View File

@ -0,0 +1 @@
../_nginx/install_site/

24
fdroid/nginx.conf Normal file
View File

@ -0,0 +1,24 @@
server {
listen 80;
listen [::]:80;
server_name $BASE_URL;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name $BASE_URL;
ssl_certificate /etc/letsencrypt/live/$BASE_URL/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/$BASE_URL/privkey.pem;
location / {
proxy_pass http://fdroid;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}