1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 09:49:28 +02:00

Repair Docker Image

This commit is contained in:
Thoralf Rickert-Wendt 2022-02-04 09:20:29 +01:00
parent 0c02baeda4
commit b4106d4f2a
6 changed files with 216 additions and 38 deletions

35
.github/workflows/docker-image.yml vendored Normal file
View file

@ -0,0 +1,35 @@
name: Docker Image CI
on:
push:
branches:
- "main"
pull_request:
branches:
- "main"
schedule:
- cron: '35 2 * * 1'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
push: true
tags: trickert76/avideo-platform:latest

1
.gitignore vendored
View file

@ -76,3 +76,4 @@ sitemap.xml
/plugin/Fishr/
/plugin/JoshWho/
.DS_Store
/.project

View file

@ -1,31 +1,119 @@
FROM ubuntu/apache2:2.4-20.04_edge
# Update OS
RUN apt-get update && apt-get upgrade -y
#RUN apt-get install dialog apt-utils -y
# Install utils
RUN apt-get install systemctl apt-transport-https lsb-release logrotate git curl vim net-tools iputils-ping nano wget -y --no-install-recommends
# Install all the rest but no php yet
#RUN DEBIAN_FRONTEND="noninteractive" apt-get install sshpass net-tools mariadb-server mariadb-client ffmpeg git libimage-exiftool-perl libapache2-mod-xsendfile python build-essential make libpcre3 libpcre3-dev libssl-dev unzip htop python3-pip -y
RUN DEBIAN_FRONTEND="noninteractive" apt-get install sshpass net-tools ffmpeg git libimage-exiftool-perl libapache2-mod-xsendfile python build-essential make libpcre3 libpcre3-dev libssl-dev unzip htop python3-pip -y
RUN cd /var/www/html && git clone https://github.com/WWBN/AVideo.git && cd /var/www/html && git clone https://github.com/WWBN/AVideo-Encoder.git && curl -L https://yt-dl.org/downloads/latest/youtube-dl -o /usr/local/bin/youtube-dl && chmod a+rx /usr/local/bin/youtube-dl && chown www-data:www-data /var/www/html/AVideo/plugin && chmod 755 /var/www/html/AVideo/plugin && curl -L https://yt-dl.org/downloads/latest/youtube-dl -o /usr/local/bin/youtube-dl && chmod a+rx /usr/local/bin/youtube-dl && a2enmod rewrite && chown www-data:www-data /var/www/html/AVideo/plugin && chmod 755 /var/www/html/AVideo/plugin && cd /var/www/html/AVideo/plugin/User_Location/install && unzip install.zip && pip3 install youtube-dl && pip3 install --upgrade youtube-dl && a2enmod expires && a2enmod headers && chmod 777 /var/www/html/AVideo/vendor/ezyang/htmlpurifier/library/HTMLPurifier/DefinitionCache/Serializer/ && mkdir /var/www/tmp && chmod 777 /var/www/tmp
LABEL maintainer="TRW <trw@acoby.de>" \
org.label-schema.schema-version="1.0" \
org.label-schema.version="1.1.0" \
org.label-schema.name="avideo-platform" \
org.label-schema.description="Audio Video Platform" \
org.label-schema.url="https://github.com/WWBN/AVideo" \
org.label-schema.vendor="WWBN"
ARG DEBIAN_FRONTEND=noninteractive
RUN a2enmod rewrite headers expires ssl xsendfile
ENV DB_MYSQL_HOST db
ENV DB_MYSQL_PORT 3306
ENV DB_MYSQL_NAME avideo
ENV DB_MYSQL_USER avideo
ENV DB_MYSQL_PASSWORD avideo
# Set new default virtualhost
RUN rm /etc/apache2/sites-enabled/000-default.conf
#COPY /var/www/html/AVideo/deploy/apache/avideo.conf /etc/apache2/sites-enabled/avideo.conf
RUN cd /var/www/html/AVideo
RUN cp /var/www/html/AVideo/deploy/apache/avideo.conf /etc/apache2/sites-enabled/avideo.conf
ENV VERSION_ENCODER 3.7
ENV SERVER_NAME avideo.localhost
ENV CREATE_TLS_CERTIFICATE yes
ENV TLS_CERTIFICATE_FILE /etc/apache2/ssl/localhost.crt
ENV TLS_CERTIFICATE_KEY /etc/apache2/ssl/localhost.key
# Retrieve package list
RUN apt update
# Install dependencies
RUN apt install -y --no-install-recommends \
systemctl \
apt-transport-https \
lsb-release \
logrotate \
git \
unzip \
curl \
wget && \
apt install -y \
ffmpeg \
libimage-exiftool-perl \
libapache2-mod-xsendfile \
libapache2-mod-php7.4 \
python \
build-essential \
make \
libpcre3 \
libpcre3-dev \
libssl-dev \
python3-pip \
php7.4 \
php7.4-common \
php7.4-cli \
php7.4-json \
php7.4-mbstring \
php7.4-curl \
php7.4-mysql \
php7.4-bcmath \
php7.4-xml \
php7.4-gd \
php7.4-zip \
php7.4-intl
COPY deploy/apache/avideo.conf /etc/apache2/sites-enabled/000-default.conf
COPY deploy/docker-entrypoint /usr/local/bin/docker-entrypoint
COPY admin /var/www/html/AVideo
COPY feed /var/www/html/AVideo
COPY install /var/www/html/AVideo
COPY locale /var/www/html/AVideo
COPY node_modules /var/www/html/AVideo
COPY objects /var/www/html/AVideo
COPY plugin /var/www/html/AVideo
COPY storage /var/www/html/AVideo
COPY updatedb /var/www/html/AVideo
COPY vendor /var/www/html/AVideo
COPY view /var/www/html/AVideo
COPY _config.yml /var/www/html/AVideo
COPY .htaccess /var/www/html/AVideo
COPY *.php /var/www/html/AVideo
COPY CNAME /var/www/html/AVideo
COPY LICENCE /var/www/html/AVideo
COPY README.md /var/www/html/AVideo
COPY *.js /var/www/html/AVideo
COPY web.config /var/www/html/AVideo
# Configure AVideo
RUN chmod 755 /usr/local/bin/docker-entrypoint && \
cd /var/www/html && \
git config --global advice.detachedHead false && \
git clone -b $VERSION_ENCODER --depth 1 https://github.com/WWBN/AVideo-Encoder.git && \
chown -R www-data:www-data /var/www/html/AVideo && \
pip3 install youtube-dl && \
cd /var/www/html/AVideo/plugin/User_Location/install && \
unzip install.zip && \
a2enmod rewrite expires headers ssl xsendfile
VOLUME /var/www/tmp
RUN mkdir -p /var/www/tmp && \
chown www-data:www-data /var/www/tmp && \
chmod 777 /var/www/tmp
VOLUME /var/www/html/AVideo/plugin
RUN mkdir -p /var/www/AVideo/plugin && \
chown www-data:www-data /var/www/html/AVideo/plugin && \
chmod 755 /var/www/html/AVideo/plugin
VOLUME /var/www/html/AVideo/videos
RUN mkdir -p /var/www/html/AVideo/videos && \
chown www-data:www-data /var/www/html/AVideo/videos && \
chmod 777 /var/www/html/AVideo/videos
WORKDIR /var/www/html/AVideo/
# Set Permision
# Create folder if not exists
RUN mkdir /var/www/html/AVideo/videos
RUN chown www-data:www-data /var/www/html/AVideo/videos && chmod 777 /var/www/html/AVideo/videos
# Now we install php stuff
RUN apt-get install php7.4 php7.4-common php7.4-cli php7.4-json php7.4-mbstring php7.4-curl php7.4-mysql php7.4-bcmath php7.4-xml php7.4-gd php7.4-zip libapache2-mod-php7.4 php7.4-intl -y
CMD apachectl -D FOREGROUND
RUN service apache2 restart
EXPOSE 443
ENTRYPOINT ["/usr/local/bin/docker-entrypoint"]
CMD ["apache2-foreground"]
HEALTHCHECK --interval=60s --timeout=55s --start-period=1s CMD curl --fail https://localhost/ || exit 1

View file

@ -1,23 +1,29 @@
<VirtualHost *:80>
DocumentRoot "/var/www/html/AVideo"
ServerName avideo.localhost
ServerName SERVER_NAME
ServerAdmin webmaster@localhost
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
#RewriteEngine on
#RewriteCond %{SERVER_NAME} =www.domain.com [OR]
#RewriteCond %{SERVER_NAME} =domain.com
#RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
<VirtualHost *:443>
DocumentRoot "/var/www/html/AVideo"
ServerName avideo.localhost
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
#SSLEngine on
#SSLCertificateFile /etc/ssl/certs/apache-selfsigned.crt
#SSLCertificateKeyFile /etc/ssl/private/apache-selfsigned.key
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI}
</VirtualHost>
<VirtualHost *:443>
ServerName SERVER_NAME
ServerAdmin webmaster@localhost
DocumentRoot "/var/www/html/AVideo"
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLEngine on
SSLCertificateFile TLS_CERTIFICATE_FILE
SSLCertificateKeyFile TLS_CERTIFICATE_KEY
</VirtualHost>
<Directory /var/www/html/AVideo/>
Options Indexes FollowSymLinks
XSendFile on
@ -26,4 +32,5 @@
Require all granted
Order Allow,Deny
Allow from All
</Directory>
</Directory>

47
deploy/docker-entrypoint Normal file
View file

@ -0,0 +1,47 @@
#!/bin/bash
echo "Starting AVideo Platform..."
CONFIG_FILE=/etc/apache2/sites-enabled/000-default.conf
if [ "_${CREATE_TLS_CERTIFICATE}_" == "_yes_" ]; then
echo "Generate Certificate..."
mkdir -p `dirname ${CREATE_TLS_CERTIFICATE}`
mkdir -p `dirname ${TLS_CERTIFICATE_KEY}`
subjectAltName="IP:127.0.0.1,DNS:${SERVER_NAME}"
CONFIG=""
CONFIG="${CONFIG}[dn]\n"
CONFIG="${CONFIG}C=Sol\n"
CONFIG="${CONFIG}L=Earth\n"
CONFIG="${CONFIG}O=AVideo\n"
CONFIG="${CONFIG}OU=Development\n"
CONFIG="${CONFIG}CN=localhost\n"
CONFIG="${CONFIG}\n"
CONFIG="${CONFIG}[req]\n"
CONFIG="${CONFIG}distinguished_name=dn\n"
CONFIG="${CONFIG}\n"
CONFIG="${CONFIG}[EXT]\n"
CONFIG="${CONFIG}subjectAltName=${subjectAltName}\n"
CONFIG="${CONFIG}extendedKeyUsage=serverAuth\n"
CONFIG="${CONFIG}\n"
openssl req -x509 \
-out ${TLS_CERTIFICATE_FILE} -keyout ${TLS_CERTIFICATE_KEY} \
-newkey rsa:4096 \
-nodes \
-sha256 \
-days 3650 \
-subj '/C=SOL/L=Earth/O=avideo/OU=DEV/CN=localhost' \
-extensions EXT -config <( \
printf "${CONFIG}")
echo "New Certificate config..."
openssl x509 -in ${TLS_CERTIFICATE_FILE} -noout -text
fi
echo "Configure Apache..."
sed -i 's#SERVER_NAME#'${SERVER_NAME}'#' ${CONFIG_FILE}
sed -i 's#TLS_CERTIFICATE_FILE#'${TLS_CERTIFICATE_FILE}'#' ${CONFIG_FILE}
sed -i 's#TLS_CERTIFICATE_KEY#'${TLS_CERTIFICATE_KEY}'#' ${CONFIG_FILE}
#eof