add docker setup for hosting the repo
This commit is contained in:
@@ -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;'"]
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user