Update Dockerfile

This commit is contained in:
Stefan Pejcic 2024-12-21 01:07:32 +01:00 committed by GitHub
parent 4e717e192b
commit 1d7f9c5d82
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -39,47 +39,7 @@ RUN apt-get update && \
########## PHP Composer ##########
COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer
RUN wget https://openlitespeed.org/packages/openlitespeed-$OLS_VERSION.tgz && \
tar xzf openlitespeed-$OLS_VERSION.tgz && cd openlitespeed && ./install.sh && \
echo 'cloud-docker' > /usr/local/lsws/PLAT && rm -rf /openlitespeed && rm /openlitespeed-$OLS_VERSION.tgz
RUN wget -O - https://repo.litespeed.sh | bash
RUN install -y $PHP_VERSION $PHP_VERSION-common $PHP_VERSION-mysql $PHP_VERSION-opcache \
$PHP_VERSION-curl $PHP_VERSION-imagick $PHP_VERSION-redis $PHP_VERSION-memcached $PHP_VERSION-intl
RUN ["/bin/bash", "-c", "if [[ $PHP_VERSION == lsphp7* ]]; then apt-get install $PHP_VERSION-json -y; fi"]
RUN wget -O /usr/local/lsws/admin/misc/lsup.sh \
https://raw.githubusercontent.com/litespeedtech/openlitespeed/master/dist/admin/misc/lsup.sh && \
chmod +x /usr/local/lsws/admin/misc/lsup.sh && \
ln -s /usr/local/lsws/$PHP_VERSION/bin/php /usr/bin/php
ENV PATH="/usr/local/sbin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/bin"
ADD docker.conf /usr/local/lsws/conf/templates/docker.conf
ADD setup_docker.sh /usr/local/lsws/bin/setup_docker.sh
ADD htpasswd /usr/local/lsws/admin/conf/htpasswd
RUN /usr/local/lsws/bin/setup_docker.sh && rm /usr/local/lsws/bin/setup_docker.sh
RUN chown 994:994 /usr/local/lsws/conf -R
RUN cp -RP /usr/local/lsws/conf/ /usr/local/lsws/.conf/
RUN cp -RP /usr/local/lsws/admin/conf /usr/local/lsws/admin/.conf/
#RUN sed -i "s|fcgi-bin/lsphp|/usr/local/lsws/$PHP_VERSION/bin/lsphp|g" /usr/local/lsws/conf/httpd_config.conf
RUN ["/bin/bash", "-c", "if [[ $PHP_VERSION == lsphp8* ]]; then ln -sf /usr/local/lsws/$PHP_VERSION/bin/lsphp /usr/local/lsws/fcgi-bin/lsphp8; fi"]
RUN ["/bin/bash", "-c", "if [[ $PHP_VERSION == lsphp8* ]]; then ln -sf /usr/local/lsws/fcgi-bin/lsphp8 /usr/local/lsws/fcgi-bin/lsphp; fi"]
RUN ["/bin/bash", "-c", "if [[ $PHP_VERSION == lsphp7* ]]; then ln -sf /usr/local/lsws/$PHP_VERSION/bin/lsphp /usr/local/lsws/fcgi-bin/lsphp7; fi"]
RUN ["/bin/bash", "-c", "if [[ $PHP_VERSION == lsphp7* ]]; then ln -sf /usr/local/lsws/fcgi-bin/lsphp7 /usr/local/lsws/fcgi-bin/lsphp; fi"]
########## MySQL ##########
COPY mysql/mysqld.cnf /etc/mysql/mysql.conf.d/
RUN chown mysql:mysql -R /var/lib/mysql
RUN usermod -d /var/lib/mysql mysql
@ -102,14 +62,39 @@ RUN MYSQL_PASSWORD=$(awk -F "=" '/password/ {gsub(/[ \t]+/, "", $2); print $2; e
EXPOSE 22 3306 7681 8080 7080
########## APACHE ##########
RUN a2enmod ssl rewrite proxy proxy_http proxy_fcgi remoteip headers
ENV APACHE_PID_FILE /var/run/apache2/apache2.pid
COPY apache/apache2.conf /etc/apache2/
########## Litespeed ##########
RUN wget https://openlitespeed.org/packages/openlitespeed-$OLS_VERSION.tgz && \
tar xzf openlitespeed-$OLS_VERSION.tgz && cd openlitespeed && ./install.sh && \
echo 'cloud-docker' > /usr/local/lsws/PLAT && rm -rf /openlitespeed && rm /openlitespeed-$OLS_VERSION.tgz
RUN wget -O - https://repo.litespeed.sh | bash
RUN install -y $PHP_VERSION $PHP_VERSION-common $PHP_VERSION-mysql $PHP_VERSION-opcache \
$PHP_VERSION-curl $PHP_VERSION-imagick $PHP_VERSION-redis $PHP_VERSION-memcached $PHP_VERSION-intl
RUN ["/bin/bash", "-c", "if [[ $PHP_VERSION == lsphp7* ]]; then apt-get install $PHP_VERSION-json -y; fi"]
RUN wget -O /usr/local/lsws/admin/misc/lsup.sh \
https://raw.githubusercontent.com/litespeedtech/openlitespeed/master/dist/admin/misc/lsup.sh && \
chmod +x /usr/local/lsws/admin/misc/lsup.sh && \
ln -s /usr/local/lsws/$PHP_VERSION/bin/php /usr/bin/php
ENV PATH="/usr/local/sbin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/bin"
ADD docker.conf /usr/local/lsws/conf/templates/docker.conf
ADD setup_docker.sh /usr/local/lsws/bin/setup_docker.sh
ADD htpasswd /usr/local/lsws/admin/conf/htpasswd
RUN /usr/local/lsws/bin/setup_docker.sh && rm /usr/local/lsws/bin/setup_docker.sh
RUN chown 994:994 /usr/local/lsws/conf -R
RUN cp -RP /usr/local/lsws/conf/ /usr/local/lsws/.conf/
RUN cp -RP /usr/local/lsws/admin/conf /usr/local/lsws/admin/.conf/
#RUN sed -i "s|fcgi-bin/lsphp|/usr/local/lsws/$PHP_VERSION/bin/lsphp|g" /usr/local/lsws/conf/httpd_config.conf
RUN ["/bin/bash", "-c", "if [[ $PHP_VERSION == lsphp8* ]]; then ln -sf /usr/local/lsws/$PHP_VERSION/bin/lsphp /usr/local/lsws/fcgi-bin/lsphp8; fi"]
RUN ["/bin/bash", "-c", "if [[ $PHP_VERSION == lsphp8* ]]; then ln -sf /usr/local/lsws/fcgi-bin/lsphp8 /usr/local/lsws/fcgi-bin/lsphp; fi"]
RUN ["/bin/bash", "-c", "if [[ $PHP_VERSION == lsphp7* ]]; then ln -sf /usr/local/lsws/$PHP_VERSION/bin/lsphp /usr/local/lsws/fcgi-bin/lsphp7; fi"]
RUN ["/bin/bash", "-c", "if [[ $PHP_VERSION == lsphp7* ]]; then ln -sf /usr/local/lsws/fcgi-bin/lsphp7 /usr/local/lsws/fcgi-bin/lsphp; fi"]
# Allow .htaccess rewrite rules (needed for WP pretty links and wpcli auto login)
#RUN sed -i '/<Directory \/var\/www\/>/,/AllowOverride None/ s/AllowOverride None/AllowOverride All/' /etc/apache2/apache2.conf
RUN mkdir -p /var/log/apache2/domlogs/