Files
env-docker/Config/F-DroidRepo/Dockerfile

119 lines
3.3 KiB
Docker

# Build a container which hosts Android apps through an F-Droid repository.
# Base Image #
FROM debian:trixie-slim
# variables #
ENV WEBROOT="/var/www/html"
ENV FDROID="/root/fdroid"
ENV REPO="$FDROID/repo"
# Install Packages#
# https://f-droid.org/en/docs/Installing_the_Server_and_Repo_Tools/#debianubuntumintetc
RUN apt-get update && apt-get install -y sudo bash curl git vim nginx
COPY files/debian-backports.sources /etc/apt/sources.list.d/
RUN apt-get update && apt-get install -y -t trixie-backports fdroidserver
# Generate F-Droid Repo #
USER root
RUN mkdir -pv "$FDROID"
WORKDIR "$FDROID"
RUN fdroid init
# Start Command #
CMD nginx -g "daemon off;"
# This is where the image would get published. #
# Configure F-Droid Repo #
ARG REPO_DOMAIN
ENV REPO_DOMAIN="$REPO_DOMAIN"
ARG REPO_NAME
ENV REPO_NAME="$REPO_NAME"
# 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
# Advanced Variables #
ARG FILE00
ENV FILE00="$FILE00"
ARG FILE01
ENV FILE01="$FILE01"
ARG FILE02
ENV FILE02="$FILE02"
ARG FILE03
ENV FILE03="$FILE03"
ARG FILE04
ENV FILE04="$FILE04"
ARG FILE05
ENV FILE05="$FILE05"
ARG FILE06
ENV FILE06="$FILE06"
ARG FILE07
ENV FILE07="$FILE07"
ARG FILE08
ENV FILE08="$FILE08"
ARG FILE09
ENV FILE09="$FILE09"
ARG FILE10
ENV FILE10="$FILE10"
ARG FILE11
ENV FILE11="$FILE11"
ARG FILE12
ENV FILE12="$FILE12"
ARG FILE13
ENV FILE13="$FILE13"
ARG FILE14
ENV FILE14="$FILE14"
ARG FILE15
ENV FILE15="$FILE15"
ARG FILE16
ENV FILE16="$FILE16"
ARG FILE17
ENV FILE17="$FILE17"
ARG FILE18
ENV FILE18="$FILE18"
ARG FILE19
ENV FILE19="$FILE19"
# Download Remote Files #
RUN mkdir -pv /root/fdroid/repo
RUN bash -c 'if [[ -n "$FILE00" ]]; then wget -P "$REPO" "$FILE00"; fi'
RUN bash -c 'if [[ -n "$FILE01" ]]; then wget -P "$REPO" "$FILE01"; fi'
RUN bash -c 'if [[ -n "$FILE02" ]]; then wget -P "$REPO" "$FILE02"; fi'
RUN bash -c 'if [[ -n "$FILE03" ]]; then wget -P "$REPO" "$FILE03"; fi'
RUN bash -c 'if [[ -n "$FILE04" ]]; then wget -P "$REPO" "$FILE04"; fi'
RUN bash -c 'if [[ -n "$FILE05" ]]; then wget -P "$REPO" "$FILE05"; fi'
RUN bash -c 'if [[ -n "$FILE06" ]]; then wget -P "$REPO" "$FILE06"; fi'
RUN bash -c 'if [[ -n "$FILE07" ]]; then wget -P "$REPO" "$FILE07"; fi'
RUN bash -c 'if [[ -n "$FILE08" ]]; then wget -P "$REPO" "$FILE08"; fi'
RUN bash -c 'if [[ -n "$FILE09" ]]; then wget -P "$REPO" "$FILE09"; fi'
RUN bash -c 'if [[ -n "$FILE10" ]]; then wget -P "$REPO" "$FILE10"; fi'
RUN bash -c 'if [[ -n "$FILE11" ]]; then wget -P "$REPO" "$FILE11"; fi'
RUN bash -c 'if [[ -n "$FILE12" ]]; then wget -P "$REPO" "$FILE12"; fi'
RUN bash -c 'if [[ -n "$FILE13" ]]; then wget -P "$REPO" "$FILE13"; fi'
RUN bash -c 'if [[ -n "$FILE14" ]]; then wget -P "$REPO" "$FILE14"; fi'
RUN bash -c 'if [[ -n "$FILE15" ]]; then wget -P "$REPO" "$FILE15"; fi'
RUN bash -c 'if [[ -n "$FILE16" ]]; then wget -P "$REPO" "$FILE16"; fi'
RUN bash -c 'if [[ -n "$FILE17" ]]; then wget -P "$REPO" "$FILE17"; fi'
RUN bash -c 'if [[ -n "$FILE18" ]]; then wget -P "$REPO" "$FILE18"; fi'
RUN bash -c 'if [[ -n "$FILE19" ]]; then wget -P "$REPO" "$FILE19"; fi'
RUN fdroid update -c
# Publish Repo Contents to Web Root #
RUN cp -r "$REPO/"* "$WEBROOT/"