From 1d7f9c5d82cadf51e16bd17f3c35fb95fe7a176f Mon Sep 17 00:00:00 2001 From: Stefan Pejcic Date: Sat, 21 Dec 2024 01:07:32 +0100 Subject: [PATCH] Update Dockerfile --- docker/ubuntu_openlitespeed_mysql/Dockerfile | 81 ++++++++------------ 1 file changed, 33 insertions(+), 48 deletions(-) diff --git a/docker/ubuntu_openlitespeed_mysql/Dockerfile b/docker/ubuntu_openlitespeed_mysql/Dockerfile index ae970e92..1f111d6a 100644 --- a/docker/ubuntu_openlitespeed_mysql/Dockerfile +++ b/docker/ubuntu_openlitespeed_mysql/Dockerfile @@ -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 '//,/AllowOverride None/ s/AllowOverride None/AllowOverride All/' /etc/apache2/apache2.conf -RUN mkdir -p /var/log/apache2/domlogs/