add docker setup for hosting the repo

This commit is contained in:
2025-10-09 21:02:20 +02:00
parent 7480ed630d
commit 19aaa4aeb0
5 changed files with 57 additions and 22 deletions
-12
View File
@@ -1,12 +0,0 @@
version: '3.8'
services:
fdroid-nginx:
image: nginx:alpine
container_name: fdroid-nginx
volumes:
- ./fdroid-repo:/usr/share/nginx/html:ro
- ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
ports:
- "8080:80"
restart: unless-stopped
+15
View File
@@ -0,0 +1,15 @@
# Use lightweight Nginx + Git
FROM nginx:alpine
# Install git and bash
RUN apk add --no-cache git bash
# Copy nginx config
COPY nginx.conf /etc/nginx/nginx.conf
# Copy update script
COPY update.sh /update.sh
RUN chmod +x /update.sh
# Start update loop + nginx
CMD ["/bin/bash", "-c", "/update.sh & nginx -g 'daemon off;'"]
+17
View File
@@ -0,0 +1,17 @@
events {}
http {
server {
listen 80;
server_name = fdroid.julian-mutter.de;
location = / {
return 302 /fdroid/repo;
}
location /fdroid/repo {
alias /repo/fdroid/repo/;
autoindex on;
}
}
}
+25
View File
@@ -0,0 +1,25 @@
#! /bin/bash
if [ ! -d "/repo/.git" ]; then
echo "Cloning repository..."
git clone --branch "$BRANCH" "$REPO_URL" "/repo"
fi
while true; do
echo "Running repo update..."
cd "/repo" || exit
git fetch origin
LOCAL=$(git rev-parse HEAD)
REMOTE=$(git rev-parse origin/binaries)
if [ "$LOCAL" != "$REMOTE" ]; then
echo "Updating repo..."
git reset --hard origin/binaries
echo "Update complete."
else
echo "Nothing to do."
fi
sleep 600 # check every 10 min
done
-10
View File
@@ -1,10 +0,0 @@
server {
listen 80;
server_name localhost;
location / {
root /usr/share/nginx/html;
autoindex on;
}
}