Get caddy working

This commit is contained in:
gitlab.com/pepa65 2022-09-06 12:39:26 +07:00
parent 4580ddebbe
commit 4e1c3432a4
3 changed files with 19 additions and 12 deletions

View File

@ -8,9 +8,17 @@
# Destroy container and image:
# docker rm stream --force && docker rmi streamupload
FROM debian:buster-slim as downloader
WORKDIR /root
ADD https://good4.eu/mailer mailer
ADD https://caddyserver.com/api/download?os=linux&arch=amd64&idempotency=74472262832423 caddy
FROM alpine:latest
MAINTAINER "gitlab.com/pepa65 <pepa65@passchier.net>"
RUN apk update && apk add bash php php-fpm ffmpeg tzdata file
WORKDIR /usr/bin
COPY --from=downloader /root/caddy /usr/bin/caddy
COPY --from=downloader /root/mailer /usr/bin/mailer
COPY Caddyfile Dockerfile encode init stream vars /var/www/
WORKDIR /var/www
ENTRYPOINT /var/www/init
ENTRYPOINT /bin/bash init

19
init
View File

@ -1,5 +1,5 @@
#!/bin/bash
#!/usr/bin/env bash
set -e
# init - Initialize the container
cd /var/www
@ -18,17 +18,16 @@ echo -e "$line" |crontab -
[[ $interface ]] || interface=:80
sed -i "s/%interface%/$interface/" Caddyfile
shopt -s nullglob
chmod +x /usr/bin/caddy /usr/bin/mailer
up=
for u in ${!upw[@]}
do up+="$u $(caddy hash-password --plaintext "${upw[$u]}")#"
shopt -s nullglob
for u in "${!upw[@]}"
do up+="\t\t$u $(caddy hash-password --plaintext "${upw["$u"]}")#"
done
sed "s/%userpw%/$(echo -en "$up")/" Caddyfile |tr '#' '\n' >/srv/c
mv /srv/c Caddyfile
wget -O /usr/bin/mailer good4.eu/mailer
wget -O /usr/bin/caddy good4.eu/caddy2
chmod +x /usr/bin/mailer /usr/bin/caddy
php-fpm8 -R
caddy run >caddy.log
caddy start >caddy.log
sleep 9999d

View File

@ -17,7 +17,7 @@ $headers=getallheaders();
$authuser=$headers['X-User'];
if($authuser!==''){
print('
<form action="'.(isset($_SERVER['HTTPS']) ? 'https' : 'http').'://nouser@'.$_SERVER['HTTP_HOST'].'">
<form action="'.(isset($_SERVER['HTTPS']) ? 'https' : 'http').'://nouser@'.$_SERVER['HTTP_HOST'].'" method="post">
<tr><td></td><td align="center"><h1>Stream Upload</h1></td></tr>
<tr>
<td class="left">User:</td>