Files
uwuzu-for-docker-compose/php/Dockerfile
T

109 lines
3.2 KiB
Docker

# Load php-apache
FROM php:8.2-apache
# Set working directory
WORKDIR /var/www/html
# Load args
ARG UWUZU_SOURCE_TAG=v1.6.6
ARG UWUZU_SOURCE_URL=https://github.com/Daichimarukana/uwuzu/releases/download
ARG UWUZU_SOURCE_FILENAME=uwuzu166.zip
ARG UWUZU_PLUGIN_PHPMAILER_URL=https://github.com/PHPMailer/PHPMailer/archive/refs/tags
ARG UWUZU_PLUGIN_PHPMAILER_FILENAME=v7.0.1.zip
ARG UWUZU_PLUGIN_WATERMARK_TAG=v1.0.0
ARG UWUZU_PLUGIN_WATERMARK_URL=https://github.com/Daichimarukana/uwuzu-AIBlockWaterMark/releases/download
ARG UWUZU_PLUGIN_WATERMARK_FILENAME=AIBlockWaterMark.zip
ARG UWUZU_PLUGIN_OBJECTSTG_TAG=3.367.2
ARG UWUZU_PLUGIN_OBJECTSTG_URL=https://github.com/aws/aws-sdk-php/releases/download
ARG UWUZU_PLUGIN_OBJECTSTG_FILENAME=aws.zip
# Run as root
USER root
# Install packages(apt)
RUN apt-get update
RUN apt-get install -y wget
RUN apt-get install -y dos2unix
RUN apt-get install -y libwebp-dev
RUN apt-get install -y libpng-dev
RUN apt-get install -y libjpeg62-turbo-dev
RUN apt-get install -y libfreetype6-dev
RUN apt-get install -y libonig-dev
RUN apt-get install -y libzip-dev
RUN apt-get install -y libcurl4-openssl-dev
RUN apt-get install -y zip
RUN apt-get install -y unzip
RUN apt-get install -y curl
RUN apt-get clean
RUN rm -rf /var/lib/apt/lists/*
# Copy app
COPY src/ /var/www/html/
# Auto download
RUN if [ -d /var/www/html ]; then \
count=$(find /var/www/html -mindepth 1 -maxdepth 1 | wc -l); \
if [ "$count" -le 1 ]; then \
# uwuzu
wget -O uwuzu.zip ${UWUZU_SOURCE_URL}/${UWUZU_SOURCE_TAG}/${UWUZU_SOURCE_FILENAME}; \
unzip uwuzu.zip; \
rm -f uwuzu.zip; \
# Plugins
cd plugin; \
## Mailer
wget -O mailer.zip ${UWUZU_PLUGIN_PHPMAILER_URL}/${UWUZU_PLUGIN_PHPMAILER_FILENAME}; \
unzip mailer.zip; \
mv PHPMailer-* PHPMailer; \
rm -f mailer.zip; \
## AIBlockWaterMark
mkdir AIBlockWaterMark; \
cd AIBlockWaterMark; \
wget -O watermark.zip ${UWUZU_PLUGIN_WATERMARK_URL}/${UWUZU_PLUGIN_WATERMARK_TAG}/${UWUZU_PLUGIN_WATERMARK_FILENAME}; \
unzip watermark.zip; \
rm -f watermark.zip; \
cd ..; \
## Object Storage
mkdir aws; \
cd aws; \
wget -O aws.zip ${UWUZU_PLUGIN_OBJECTSTG_URL}/${UWUZU_PLUGIN_OBJECTSTG_TAG}/${UWUZU_PLUGIN_OBJECTSTG_FILENAME}; \
unzip aws.zip; \
rm -f aws.zip; \
cd ..; \
## Change Directory
cd ..; \
fi; \
fi
# Remove flag
RUN rm -f .source-flag
# Change line break code
RUN find /var/www/html -type f -exec dos2unix {} \;
# Install PHP extensions
RUN docker-php-ext-configure gd --with-freetype --with-webp
RUN docker-php-ext-install gd
RUN docker-php-ext-install pdo_mysql
RUN docker-php-ext-install mysqli
RUN docker-php-ext-install mbstring
RUN docker-php-ext-install zip
RUN docker-php-ext-install fileinfo
RUN docker-php-ext-install curl
# Enable Apache modules
RUN a2enmod rewrite
RUN a2enmod headers
# Copy custom configuration
COPY php/php.ini /usr/local/etc/php/conf.d/99-custom.ini
COPY php/apache2.conf /etc/apache2/conf-enabled/99-custom.conf
# Set permissions
RUN chown -R www-data:www-data /var/www/html
RUN find /var/www/html -type d -exec chmod 775 {} \;
RUN find /var/www/html -type f -exec chmod 775 {} \;
RUN chmod 775 /var/www/html
# Start Apache
CMD ["apache2-foreground"]