|
| 1 | +FROM ghcr.io/computestacks/cs-docker-base:ubuntu-focal |
| 2 | + |
| 3 | +ENV PHP_VERSION="8.0" |
| 4 | + |
| 5 | +LABEL maintainer="https://computestacks.com" |
| 6 | +LABEL org.opencontainers.image.authors="https://computestacks.com" |
| 7 | +LABEL org.opencontainers.image.source="https://github.com/ComputeStacks/cs-docker-php/tree/main/litespeed/8.0" |
| 8 | +LABEL org.opencontainers.image.url="https://github.com/ComputeStacks/cs-docker-php/tree/main/litespeed/8.0" |
| 9 | +LABEL org.opencontainers.image.title="PHP 8.0 with OpenLiteSpeed" |
| 10 | + |
| 11 | +COPY root/monarx-agent.sh /tmp/ |
| 12 | +COPY root/postfix-run.sh /tmp/ |
| 13 | +COPY root/postfix-log-run.sh /tmp/ |
| 14 | +COPY root/40-ls-config.sh /etc/my_init.d/ |
| 15 | +COPY root/50-entrypoint.sh /etc/my_init.d/ |
| 16 | +COPY root/51-ls-env.sh /etc/my_init.d/ |
| 17 | +COPY root/60-litespeed-upgrade.sh /etc/my_init.d/ |
| 18 | +COPY root/60-php-config.sh /etc/my_init.d/ |
| 19 | +COPY root/61-newrelic.sh /etc/my_init.d/ |
| 20 | +COPY root/90-litespeed-password.sh /etc/my_init.d/ |
| 21 | +COPY root/91-litespeed-config.sh /etc/my_init.d/ |
| 22 | +COPY root/90-monarx-entry.sh /etc/my_init.d/ |
| 23 | +COPY root/90-postfix.sh /etc/my_init.d/ |
| 24 | +COPY root/90-relay.sh /etc/my_init.d/ |
| 25 | +COPY root/99-litespeed.sh /etc/my_init.d/ |
| 26 | +COPY root/migrate_php.sh /usr/local/bin/migrate_php_version |
| 27 | + |
| 28 | +RUN set -ex; \ |
| 29 | + \ |
| 30 | + apt-get update; \ |
| 31 | + apt-get install -y --no-install-recommends \ |
| 32 | + autoconf \ |
| 33 | + build-essential \ |
| 34 | + wget \ |
| 35 | + dpkg-dev \ |
| 36 | + file \ |
| 37 | + g++ \ |
| 38 | + gcc \ |
| 39 | + libc-dev \ |
| 40 | + make \ |
| 41 | + pkg-config \ |
| 42 | + re2c \ |
| 43 | + dirmngr \ |
| 44 | + gnupg \ |
| 45 | + libcurl4-openssl-dev \ |
| 46 | + libedit-dev \ |
| 47 | + libsodium-dev \ |
| 48 | + libsqlite3-dev \ |
| 49 | + libssl-dev \ |
| 50 | + libxml2-dev \ |
| 51 | + zlib1g-dev \ |
| 52 | + procps \ |
| 53 | + vim \ |
| 54 | + tree \ |
| 55 | + zip \ |
| 56 | + unzip \ |
| 57 | + libpng-dev \ |
| 58 | + libbz2-dev \ |
| 59 | + libmemcached-dev \ |
| 60 | + libfreetype6-dev \ |
| 61 | + libc-client-dev \ |
| 62 | + libkrb5-dev \ |
| 63 | + libxslt-dev \ |
| 64 | + libicu-dev \ |
| 65 | + imagemagick \ |
| 66 | + libmagickwand-dev \ |
| 67 | + libmariadb-dev \ |
| 68 | + mariadb-client \ |
| 69 | + libmcrypt-dev \ |
| 70 | + mcrypt \ |
| 71 | + expect \ |
| 72 | + net-tools \ |
| 73 | + ca-certificates \ |
| 74 | + curl \ |
| 75 | + xz-utils \ |
| 76 | + inotify-tools \ |
| 77 | + mailutils \ |
| 78 | + apt-utils \ |
| 79 | + libzstd-dev \ |
| 80 | + liblzf-dev \ |
| 81 | + git \ |
| 82 | + ; \ |
| 83 | + echo "postfix postfix/mailname string docker.local" | debconf-set-selections \ |
| 84 | + && echo "postfix postfix/main_mailer_type string 'Internet Site'" | debconf-set-selections \ |
| 85 | + && apt-get -y install postfix postfix-pcre libsasl2-modules \ |
| 86 | + ; \ |
| 87 | + wget -O - http://rpms.litespeedtech.com/debian/enable_lst_debain_repo.sh | bash \ |
| 88 | + ; \ |
| 89 | + apt-get install -y --no-install-recommends \ |
| 90 | + lsphp80 \ |
| 91 | + lsphp80-common \ |
| 92 | + lsphp80-curl \ |
| 93 | + lsphp80-dev \ |
| 94 | + lsphp80-imap \ |
| 95 | + lsphp80-imagick \ |
| 96 | + lsphp80-intl \ |
| 97 | + lsphp80-memcached \ |
| 98 | + lsphp80-msgpack \ |
| 99 | + lsphp80-mysql \ |
| 100 | + lsphp80-opcache \ |
| 101 | + lsphp80-pgsql \ |
| 102 | + lsphp80-sqlite3 \ |
| 103 | + lsphp80-modules-source \ |
| 104 | + php-cli \ |
| 105 | + php-mysql \ |
| 106 | + openlitespeed \ |
| 107 | + rcs \ |
| 108 | + sudo \ |
| 109 | + libonig-dev \ |
| 110 | + libzip-dev \ |
| 111 | + ; \ |
| 112 | + mkdir -p /var/www && mkdir /usr/src/default \ |
| 113 | + ; \ |
| 114 | + ln -s /usr/local/lsws/lsphp80/bin/phpize /usr/local/bin/phpize; \ |
| 115 | + ln -s /usr/local/lsws/lsphp80/bin/php-config /usr/local/bin/php-config \ |
| 116 | + ; \ |
| 117 | + curl https://repository.monarx.com/repository/monarx/publickey/monarxpub.gpg | gpg -o /usr/share/keyrings/monarx-archive-keyring.gpg --dearmor \ |
| 118 | + && echo "deb [signed-by=/usr/share/keyrings/monarx-archive-keyring.gpg] https://repository.monarx.com/repository/ubuntu-jammy/ jammy main" > /etc/apt/sources.list.d/monarx.list \ |
| 119 | + ; \ |
| 120 | + apt-get update \ |
| 121 | + && apt-get -y install monarx-agent monarx-protect \ |
| 122 | + ; \ |
| 123 | + mkdir -p /etc/service/monarx \ |
| 124 | + && mv /tmp/monarx-agent.sh /etc/service/monarx/run \ |
| 125 | + && touch /etc/service/monarx/down \ |
| 126 | + && chmod +x /etc/service/monarx/run \ |
| 127 | + && chmod +x /usr/local/bin/migrate_php_version \ |
| 128 | + ; \ |
| 129 | + apt-get clean \ |
| 130 | + && rm -rf /var/lib/apt/lists/* |
| 131 | + |
| 132 | +RUN cd /usr/src; \ |
| 133 | + git clone https://github.com/phpredis/phpredis.git \ |
| 134 | + && cd /usr/src/phpredis \ |
| 135 | + && git checkout $(curl -fs -L https://api.github.com/repos/phpredis/phpredis/releases/latest | grep -i "tag_name" | awk -F '"' '{print $4}') \ |
| 136 | + && phpize \ |
| 137 | + && ./configure --enable-redis-igbinary --enable-redis-zstd --with-liblzf --enable-redis-msgpack \ |
| 138 | + && make \ |
| 139 | + && make install \ |
| 140 | + && echo "extension=redis.so" > /usr/local/lsws/lsphp80/etc/php/8.0/mods-available/redis.ini \ |
| 141 | + ; \ |
| 142 | + RELAY_VERSION=$(curl -fs -L https://builds.r2.relay.so/meta/latest | awk -F '"' '{print $1}') \ |
| 143 | + && wget -O /tmp/relay.tar.gz "https://builds.r2.relay.so/$RELAY_VERSION/relay-$RELAY_VERSION-php8.0-debian-x86-64.tar.gz" \ |
| 144 | + && tar -xzf /tmp/relay.tar.gz -C /usr/src \ |
| 145 | + && mv /usr/src/relay-* /usr/src/relay \ |
| 146 | + && sed -i "s/00000000-0000-0000-0000-000000000000/$(cat /proc/sys/kernel/random/uuid)/" /usr/src/relay/relay-pkg.so \ |
| 147 | + && rm /tmp/relay.tar.gz \ |
| 148 | + ; \ |
| 149 | + wget -O /tmp/newrelic.tar.gz https://download.newrelic.com$(curl -fs -L https://download.newrelic.com/php_agent/release/ | grep -Eo "/\S+-linux.tar.gz\"" | tr -d '"') \ |
| 150 | + && tar -xzvf /tmp/newrelic.tar.gz -C /usr/src \ |
| 151 | + && mv /usr/src/newrelic-php5-*-linux /usr/src/newrelic \ |
| 152 | + && mv /usr/src/newrelic/daemon/newrelic-daemon.x64 /usr/bin/newrelic-daemon \ |
| 153 | + && chown root: /usr/bin/newrelic-daemon \ |
| 154 | + && mkdir -p /var/log/newrelic \ |
| 155 | + && touch /var/log/newrelic/newrelic-daemon.log \ |
| 156 | + && chmod 666 /var/log/newrelic/newrelic-daemon.log \ |
| 157 | + && touch /var/log/newrelic/php_agent.log \ |
| 158 | + && chmod 644 /var/log/newrelic/php_agent.log \ |
| 159 | + && rm /tmp/newrelic.tar.gz |
| 160 | + |
| 161 | +COPY root/www /usr/src/default/ |
| 162 | +COPY root/vhosts /usr/local/lsws/conf/vhosts/ |
| 163 | + |
| 164 | +RUN mkdir -p /etc/service/postfix \ |
| 165 | + && mkdir -p /etc/service/postfix-log \ |
| 166 | + && mv /tmp/postfix-run.sh /etc/service/postfix/run \ |
| 167 | + && mv /tmp/postfix-log-run.sh /etc/service/postfix-log/run \ |
| 168 | + && chmod +x /etc/service/postfix/run \ |
| 169 | + && chmod +x /etc/service/postfix-log/run \ |
| 170 | + && touch /etc/service/postfix/down \ |
| 171 | + && touch /etc/service/postfix-log/down \ |
| 172 | + ; \ |
| 173 | + cd /usr/local/lsws/fcgi-bin/ \ |
| 174 | + && rm lsphp \ |
| 175 | + && ln -s /usr/local/lsws/lsphp80/bin/lsphp lsphp \ |
| 176 | + && cd /usr/local/lsws/lsphp80/bin \ |
| 177 | + && chmod +x /etc/my_init.d/*.sh \ |
| 178 | + && rm /usr/local/lsws/conf/httpd_config.conf \ |
| 179 | + ; \ |
| 180 | + mv /usr/local/lsws /usr/src \ |
| 181 | + && chown -R lsadm:lsadm /usr/src/lsws/conf \ |
| 182 | + && echo "max_input_vars = 3000" >> /usr/src/lsws/lsphp80/etc/php/8.0/litespeed/php.ini \ |
| 183 | + && sed -i 's/memory_limit = .*/memory_limit = 192M/g' /usr/src/lsws/lsphp80/etc/php/8.0/litespeed/php.ini \ |
| 184 | + && sed -i 's/upload_max_filesize = .*/upload_max_filesize = 250M/g' /usr/src/lsws/lsphp80/etc/php/8.0/litespeed/php.ini \ |
| 185 | + && sed -i 's/max_input_time = .*/max_input_time = 300/g' /usr/src/lsws/lsphp80/etc/php/8.0/litespeed/php.ini \ |
| 186 | + && sed -i 's/max_execution_time = .*/max_execution_time = 300/g' /usr/src/lsws/lsphp80/etc/php/8.0/litespeed/php.ini \ |
| 187 | + && echo "date.timezone = 'UTC'" >> /usr/src/lsws/lsphp80/etc/php/8.0/litespeed/php.ini \ |
| 188 | + && echo "post_max_size = 250M" >> /usr/src/lsws/lsphp80/etc/php/8.0/litespeed/php.ini \ |
| 189 | + ; \ |
| 190 | + usermod -u 1001 www-data && groupmod -g 1001 www-data |
| 191 | + |
| 192 | +COPY root/lswsctrl.sh /usr/local/bin/lswsctrl |
| 193 | +COPY root/httpd_config.conf /usr/src/lsws/conf/httpd_config.conf |
| 194 | +COPY root/monarx-agent.conf /etc/monarx-agent.conf |
| 195 | + |
| 196 | +HEALTHCHECK --interval=30s --timeout=3s \ |
| 197 | + CMD curl --get --fail http://localhost/healthcheck/ || exit 1 |
| 198 | + |
| 199 | +EXPOSE 80 7080 |
0 commit comments