Overhaul F-Droid Dockerfile now that it works.

This commit is contained in:
2026-07-04 14:46:30 -07:00
parent 07703e72db
commit e349ad0aeb
+119 -48
View File
@@ -4,11 +4,21 @@
FROM debian:trixie-slim FROM debian:trixie-slim
# variables # # Static Variables #
ENV DOWNLOAD="/root/Downloads"
ENV WEBROOT="/var/www/html" ENV WEBROOT="/var/www/html"
ENV FDROID="/root/fdroid" ENV FDROID="/root/fdroid"
ENV METADATA="$FDROID/metadata"
ENV REPO="$FDROID/repo" ENV REPO="$FDROID/repo"
ENV CONFIG="$FDROID/config.yml"
# Create Directory Hierarchies #
RUN mkdir -pv "$DOWNLOAD" "$WEBROOT" \
"$FDROID" "$METADATA" "$REPO"
# Install Packages# # Install Packages#
# https://f-droid.org/en/docs/Installing_the_Server_and_Repo_Tools/#debianubuntumintetc # https://f-droid.org/en/docs/Installing_the_Server_and_Repo_Tools/#debianubuntumintetc
@@ -20,25 +30,10 @@ RUN apt-get update && apt-get install -y -t trixie-backports fdroidserver
# Generate F-Droid Repo # # Generate F-Droid Repo #
USER root USER root
RUN mkdir -pv "$FDROID"
WORKDIR "$FDROID" WORKDIR "$FDROID"
RUN fdroid init RUN fdroid init
# This is where the image would get published. # # This is where the image would get published on Docker Hub. #
# Configure F-Droid Repo #
ARG REPO_DOMAIN
ENV REPO_DOMAIN="$REPO_DOMAIN"
ARG REPO_NAME
ENV REPO_NAME="$REPO_NAME"
ARG REPO_ICON
ENV REPO_ICON="$REPO_ICON"
# TBD/TODO: Add commands to remove repo_url and repo_name if they already exist.
RUN sed -i "$ a repo_url: $REPO_DOMAIN/fdroid/repo" "$FDROID/config.yml"
RUN sed -i "$ a repo_name: $REPO_NAME" "$FDROID/config.yml"
RUN fdroid update RUN fdroid update
@@ -84,42 +79,118 @@ ARG FILE18
ENV FILE18="$FILE18" ENV FILE18="$FILE18"
ARG FILE19 ARG FILE19
ENV FILE19="$FILE19" ENV FILE19="$FILE19"
ARG FILE20
ENV FILE20="$FILE20"
ARG FILE21
ENV FILE21="$FILE21"
ARG FILE22
ENV FILE22="$FILE22"
ARG FILE23
ENV FILE23="$FILE23"
ARG FILE24
ENV FILE24="$FILE24"
ARG FILE25
ENV FILE25="$FILE25"
ARG FILE26
ENV FILE26="$FILE26"
ARG FILE27
ENV FILE27="$FILE27"
ARG FILE28
ENV FILE28="$FILE28"
ARG FILE29
ENV FILE29="$FILE29"
ARG FILE30
ENV FILE30="$FILE30"
ARG FILE31
ENV FILE31="$FILE31"
ARG FILE32
ENV FILE32="$FILE32"
ARG FILE33
ENV FILE33="$FILE33"
ARG FILE34
ENV FILE34="$FILE34"
ARG FILE35
ENV FILE35="$FILE35"
ARG FILE36
ENV FILE36="$FILE36"
ARG FILE37
ENV FILE37="$FILE37"
ARG FILE38
ENV FILE38="$FILE38"
ARG FILE39
ENV FILE39="$FILE39"
# Download Remote Files # # Download Remote Files #
RUN mkdir -pv /root/fdroid/repo ADD "$FILE00" "$DOWNLOAD"/
RUN bash -c 'if [[ -n "$FILE00" ]]; then wget -P "$REPO" "$FILE00"; fi' ADD "$FILE01" "$DOWNLOAD"/
RUN bash -c 'if [[ -n "$FILE01" ]]; then wget -P "$REPO" "$FILE01"; fi' ADD "$FILE02" "$DOWNLOAD"/
RUN bash -c 'if [[ -n "$FILE02" ]]; then wget -P "$REPO" "$FILE02"; fi' ADD "$FILE03" "$DOWNLOAD"/
RUN bash -c 'if [[ -n "$FILE03" ]]; then wget -P "$REPO" "$FILE03"; fi' ADD "$FILE04" "$DOWNLOAD"/
RUN bash -c 'if [[ -n "$FILE04" ]]; then wget -P "$REPO" "$FILE04"; fi' ADD "$FILE05" "$DOWNLOAD"/
RUN bash -c 'if [[ -n "$FILE05" ]]; then wget -P "$REPO" "$FILE05"; fi' ADD "$FILE06" "$DOWNLOAD"/
RUN bash -c 'if [[ -n "$FILE06" ]]; then wget -P "$REPO" "$FILE06"; fi' ADD "$FILE08" "$DOWNLOAD"/
ADD "$FILE07" "$REPO"/ ADD "$FILE09" "$DOWNLOAD"/
#RUN bash -c 'if [[ -n "$FILE07" ]]; then wget -P "$REPO" "$FILE07"; fi' ADD "$FILE10" "$DOWNLOAD"/
RUN bash -c 'if [[ -n "$FILE08" ]]; then wget -P "$REPO" "$FILE08"; fi' ADD "$FILE11" "$DOWNLOAD"/
RUN bash -c 'if [[ -n "$FILE09" ]]; then wget -P "$REPO" "$FILE09"; fi' ADD "$FILE12" "$DOWNLOAD"/
RUN bash -c 'if [[ -n "$FILE10" ]]; then wget -P "$REPO" "$FILE10"; fi' ADD "$FILE13" "$DOWNLOAD"/
RUN bash -c 'if [[ -n "$FILE11" ]]; then wget -P "$REPO" "$FILE11"; fi' ADD "$FILE14" "$DOWNLOAD"/
RUN bash -c 'if [[ -n "$FILE12" ]]; then wget -P "$REPO" "$FILE12"; fi' ADD "$FILE15" "$DOWNLOAD"/
RUN bash -c 'if [[ -n "$FILE13" ]]; then wget -P "$REPO" "$FILE13"; fi' ADD "$FILE16" "$DOWNLOAD"/
RUN bash -c 'if [[ -n "$FILE14" ]]; then wget -P "$REPO" "$FILE14"; fi' ADD "$FILE17" "$DOWNLOAD"/
RUN bash -c 'if [[ -n "$FILE15" ]]; then wget -P "$REPO" "$FILE15"; fi' ADD "$FILE18" "$DOWNLOAD"/
RUN bash -c 'if [[ -n "$FILE16" ]]; then wget -P "$REPO" "$FILE16"; fi' ADD "$FILE19" "$DOWNLOAD"/
RUN bash -c 'if [[ -n "$FILE17" ]]; then wget -P "$REPO" "$FILE17"; fi' ADD "$FILE20" "$DOWNLOAD"/
RUN bash -c 'if [[ -n "$FILE18" ]]; then wget -P "$REPO" "$FILE18"; fi' ADD "$FILE21" "$DOWNLOAD"/
RUN bash -c 'if [[ -n "$FILE19" ]]; then wget -P "$REPO" "$FILE19"; fi' ADD "$FILE22" "$DOWNLOAD"/
ADD "$FILE23" "$DOWNLOAD"/
ADD "$FILE24" "$DOWNLOAD"/
ADD "$FILE25" "$DOWNLOAD"/
ADD "$FILE26" "$DOWNLOAD"/
ADD "$FILE27" "$DOWNLOAD"/
ADD "$FILE28" "$DOWNLOAD"/
ADD "$FILE29" "$DOWNLOAD"/
ADD "$FILE30" "$DOWNLOAD"/
ADD "$FILE31" "$DOWNLOAD"/
ADD "$FILE32" "$DOWNLOAD"/
ADD "$FILE33" "$DOWNLOAD"/
ADD "$FILE34" "$DOWNLOAD"/
ADD "$FILE35" "$DOWNLOAD"/
ADD "$FILE36" "$DOWNLOAD"/
ADD "$FILE37" "$DOWNLOAD"/
ADD "$FILE38" "$DOWNLOAD"/
ADD "$FILE39" "$DOWNLOAD"/
RUN sync # Move Downloaded Files #
# Move any downloaded metadata files to the correct folder. # Move any downloaded APK files to the repo folder.
RUN mv -v "$REPO"/*.yml "$REPO"/../metadata || \ RUN mv -v "$DOWNLOAD"/*.apk "$REPO"/ || \
echo "WARNING! No YML file(s) to copy." && sleep 10 (echo "WARNING! No APK file(s) to copy." && sleep 10)
# Move any downloaded icons to the proper folder. # Move any downloaded metadata files to the metadata folder.
RUN mv -v "$REPO"/*.png "$FDROID"/ || \ RUN mv -v "$DOWNLOAD"/*.yml "$METADATA"/ || \
echo "WARNING! No PNG file(s) to copy." && sleep 10 (echo "WARNING! No YML file(s) to copy." && sleep 10)
# Move any downloaded icons to the main folder.
RUN mv -v "$DOWNLOAD"/*.png "$FDROID"/ || \
(echo "WARNING! No PNG file(s) to copy." && sleep 10)
# Configure F-Droid Repo #
ARG REPO_DOMAIN
ENV REPO_DOMAIN="$REPO_DOMAIN"
ARG REPO_NAME
ENV REPO_NAME="$REPO_NAME"
ARG REPO_ICON
ENV REPO_ICON="$REPO_ICON"
RUN sed -i '/repo_url/d' "$CONFIG"
RUN sed -i '/repo_name/d' "$CONFIG"
RUN sed -i '/repo_icon/d' "$CONFIG"
RUN sed -i "$ a repo_url: $REPO_DOMAIN/fdroid/repo" "$CONFIG"
RUN sed -i "$ a repo_name: $REPO_NAME" "$CONFIG"
# If the icon variable is set, add it to the config file before updating. # If the icon variable is set, add it to the config file before updating.
RUN [ ! -z "$REPO_ICON" ] && \ RUN [ ! -z "$REPO_ICON" ] && \
sed -i "$ a repo_icon: $REPO_ICON" "$FDROID/config.yml" sed -i "$ a repo_icon: $REPO_ICON" "$FDROID/config.yml"
@@ -131,8 +202,8 @@ RUN fdroid update -c
RUN cp -rv "$FDROID" "$WEBROOT/" RUN cp -rv "$FDROID" "$WEBROOT/"
# The index files are in repo. # The index files are in repo.
# TODO: Can NGINX be configured to serve this as root while still # TODO: Can NGINX be configured to serve REPO as the webroot while still
# having the URL be fdroid/repo/? How do others handle this? # having the user's URL be fdroid/repo/? How do others handle this?
RUN cp -rv "$REPO"/* "$WEBROOT/" RUN cp -rv "$REPO"/* "$WEBROOT/"
# Start Command # # Start Command #