Use caddy as HTTP server

This commit is contained in:
wpetit 2018-11-19 21:43:09 +01:00
parent 7d7f4ccfc2
commit 38f0908cb4
7 changed files with 21 additions and 14 deletions

4
Caddyfile Normal file
View File

@ -0,0 +1,4 @@
{$FDROID_REPO_HOST}
gzip
log stdout
browse

View File

@ -10,7 +10,7 @@ RUN apk add --no-cache \
python3 build-base freetype-dev libffi-dev \ python3 build-base freetype-dev libffi-dev \
libpng-dev py3-setuptools python3-dev libxml2-dev \ libpng-dev py3-setuptools python3-dev libxml2-dev \
libxslt-dev openssl-dev jpeg-dev java-common \ libxslt-dev openssl-dev jpeg-dev java-common \
bash supervisor openssh inotify-tools gettext openjdk8 fastjar darkhttpd bash supervisor openssh inotify-tools gettext openjdk8 fastjar caddy
RUN ln -s /usr/bin/fastjar /usr/bin/jar RUN ln -s /usr/bin/fastjar /usr/bin/jar
RUN ln -s /usr/include/libxml2 /usr/include/libxml RUN ln -s /usr/include/libxml2 /usr/include/libxml
@ -29,6 +29,7 @@ RUN mkdir /fdroid
WORKDIR /fdroid WORKDIR /fdroid
COPY config.py /fdroid/config.py.tmpl COPY config.py /fdroid/config.py.tmpl
COPY Caddyfile /fdroid/Caddyfile
COPY fdroid-update.sh /fdroid/fdroid-update.sh COPY fdroid-update.sh /fdroid/fdroid-update.sh
RUN chmod +x /fdroid/fdroid-update.sh RUN chmod +x /fdroid/fdroid-update.sh

View File

@ -12,11 +12,12 @@ build:
run: run:
docker run -it --rm \ docker run -it --rm \
-p 2222:2222 \ -p 2222:2222 \
-p 8080:8080 \ -p 8080:2015 \
-v "$(PWD)/data/repo:/fdroid/repo" \ -v "$(PWD)/data/repo:/fdroid/repo" \
-v "$(PWD)/data/metadata:/fdroid/metadata" \ -v "$(PWD)/data/metadata:/fdroid/metadata" \
-v "$(PWD)/data/keystore:/fdroid/keystore" \ -v "$(PWD)/data/keystore:/fdroid/keystore" \
-e "FDROID_REPO_URL=http://localhost:8080" \ -v "/etc/localtime:/etc/localtime:ro" \
-e "FDROID_REPO_HOST=0.0.0.0" \
-e "FDROID_REPO_NAME=My local repo" \ -e "FDROID_REPO_NAME=My local repo" \
-e "FDROID_REPO_DESCRIPTION=My repo description" \ -e "FDROID_REPO_DESCRIPTION=My repo description" \
-e "FDROID_KEYSTORE_PASS=mykeystorepass" \ -e "FDROID_KEYSTORE_PASS=mykeystorepass" \

View File

@ -54,7 +54,7 @@ java_paths = {
# The same policy is applied to the archive repo, if there is one. # The same policy is applied to the archive repo, if there is one.
# repo_maxage = 0 # repo_maxage = 0
repo_url = "${FDROID_REPO_URL}" repo_url = "https://${FDROID_REPO_HOST}"
repo_name = "${FDROID_REPO_NAME}" repo_name = "${FDROID_REPO_NAME}"
repo_icon = "${FDROID_REPO_ICON}" repo_icon = "${FDROID_REPO_ICON}"
repo_description = """ repo_description = """

View File

@ -6,8 +6,7 @@ EVENT=$1
DIR=$2 DIR=$2
FILE=$3 FILE=$3
if [ -z "$FILE" ] || [[ "$FILE" == *.apk ]]; then if [ -z "$FILE" ] || [[ "$FILE" == *.apk ]] || [[ "$FILE" == *.yml ]]; then
fdroid update -c --rename-apks --clean --use-date-from-apk fdroid update -c --rename-apks --clean
fdroid update --rename-apks --clean --use-date-from-apk
fi fi

View File

@ -8,12 +8,14 @@ set +a
docker run -it -d \ docker run -it -d \
--restart always \ --restart always \
-p 80:8080 \ -p 80:80 \
-p 443:443 \
-p 2222:2222 \ -p 2222:2222 \
-v "${PWD}/data/repo:/fdroid/repo" \ -v "${PWD}/data/repo:/fdroid/repo" \
-v "${PWD}/data/metadata:/fdroid/metadata" \ -v "${PWD}/data/metadata:/fdroid/metadata" \
-v "${PWD}/data/keystore:/fdroid/keystore" \ -v "${PWD}/data/keystore:/fdroid/keystore" \
-e "FDROID_REPO_URL=${REPO_URL}" \ -v "/etc/localtime:/etc/localtime:ro" \
-e "FDROID_REPO_HOST=${REPO_HOST}" \
-e "FDROID_REPO_NAME=${REPO_NAME}" \ -e "FDROID_REPO_NAME=${REPO_NAME}" \
-e "FDROID_REPO_DESCRIPTION=${REPO_DESCRIPTION}" \ -e "FDROID_REPO_DESCRIPTION=${REPO_DESCRIPTION}" \
-e "FDROID_KEYSTORE_PASS=${KEYSTORE_PASS}" \ -e "FDROID_KEYSTORE_PASS=${KEYSTORE_PASS}" \

View File

@ -14,7 +14,7 @@ stderr_logfile_maxbytes=0
[program:fdroid-update] [program:fdroid-update]
command = inotifyd /fdroid/fdroid-update.sh /fdroid/repo:w command = inotifyd /fdroid/fdroid-update.sh /fdroid/repo:w /fdroid/metadata:w
directory = /fdroid directory = /fdroid
user = fdroid user = fdroid
autostart = true autostart = true
@ -23,10 +23,10 @@ stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0 stderr_logfile_maxbytes=0
[program:darkhttpd] [program:caddy]
command = darkhttpd /fdroid/repo --port 8080 command = caddy -conf /fdroid/Caddyfile
directory = /fdroid directory = /fdroid/repo
user = fdroid user = root
autostart = true autostart = true
stdout_logfile=/dev/stdout stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0 stdout_logfile_maxbytes=0