diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8ac9ded..72e9b8a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,14 +25,14 @@ jobs: if [[ $GITHUB_REF == refs/tags/* ]]; then TAGS="$TAGS,${GITHUB_REPOSITORY}:latest" - elif [[ $VERSION == "master" ]]; then + elif [[ $VERSION == "main" ]]; then TAGS="$TAGS,${GITHUB_REPOSITORY}:beta" fi GHCR_TAGS="${GHCR_IMAGE}:${VERSION}" if [[ $GITHUB_REF == refs/tags/* ]]; then GHCR_TAGS="$GHCR_TAGS,${GHCR_IMAGE}:latest" - elif [[ $VERSION == "master" ]]; then + elif [[ $VERSION == "main" ]]; then GHCR_TAGS="$GHCR_TAGS,${GHCR_IMAGE}:beta" fi diff --git a/Dockerfile b/Dockerfile index c65d2ee..0daac8b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,7 +8,7 @@ COPY --chown=nobody rootfs/ / # crond needs root, so install dcron and cap package and set the capabilities # on dcron binary https://github.com/inter169/systs/blob/master/alpine/crond/README.md -RUN apk add --no-cache dcron libcap php83-exif php83-pecl-redis php83-pecl-igbinary php83-ldap && \ +RUN apk add --no-cache dcron libcap php84-exif php84-pecl-redis php84-pecl-igbinary php84-ldap && \ chown nobody:nobody /usr/sbin/crond && \ setcap cap_setgid=ep /usr/sbin/crond diff --git a/README.md b/README.md index 95620e3..98000e9 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,8 @@ [![Docker Pulls](https://img.shields.io/docker/pulls/erseco/alpine-moodle.svg)](https://hub.docker.com/r/erseco/alpine-moodle/) ![Docker Image Size](https://img.shields.io/docker/image-size/erseco/alpine-moodle) ![nginx 1.26](https://img.shields.io/badge/nginx-1.26-brightgreen.svg) -![php 8.3](https://img.shields.io/badge/php-8.3-brightgreen.svg) -![moodle-4.4.0](https://img.shields.io/badge/moodle-4.4-yellow) +![php 8.4](https://img.shields.io/badge/php-8.4-brightgreen.svg) +![moodle-4.5.0](https://img.shields.io/badge/moodle-4.5-yellow) ![License MIT](https://img.shields.io/badge/license-MIT-blue.svg) @@ -16,7 +16,7 @@ Repository: https://github.com/erseco/alpine-moodle * Built on the lightweight image https://github.com/erseco/alpine-php-webserver * Very small Docker image size (+/-70MB) -* Uses PHP 8.3 for better performance, lower cpu usage & memory footprint +* Uses PHP 8.4 for better performance, lower cpu usage & memory footprint * Support for HA installations: php-redis, php-ldap (also with self-signed certs) * Multi-arch support: 386, amd64, arm/v6, arm/v7, arm64, ppc64le, s390x * Optimized for 100 concurrent users @@ -98,7 +98,6 @@ You can define commands to be executed before and after the configuration of Moo Example `docker-compose.yml` configuration: ```yaml -version: '3' services: moodle: image: erseco/alpine-moodle diff --git a/rootfs/docker-entrypoint-init.d/02-configure-moodle.sh b/rootfs/docker-entrypoint-init.d/02-configure-moodle.sh index a6e3fde..994f6c3 100755 --- a/rootfs/docker-entrypoint-init.d/02-configure-moodle.sh +++ b/rootfs/docker-entrypoint-init.d/02-configure-moodle.sh @@ -55,7 +55,7 @@ check_db_availability() { # Function to generate config.php file generate_config_file() { echo "Generating config.php file..." - ENV_VAR='var' php83 -d max_input_vars=10000 /var/www/html/admin/cli/install.php \ + ENV_VAR='var' php84 -d max_input_vars=10000 /var/www/html/admin/cli/install.php \ --lang=$MOODLE_LANGUAGE \ --wwwroot=$SITE_URL \ --dataroot=/var/www/moodledata/ \ @@ -80,7 +80,7 @@ generate_config_file() { # Function to install the database install_database() { echo "Installing database..." - php83 -d max_input_vars=10000 /var/www/html/admin/cli/install_database.php \ + php84 -d max_input_vars=10000 /var/www/html/admin/cli/install_database.php \ --lang=$MOODLE_LANGUAGE \ --adminuser=$MOODLE_USERNAME \ --adminpass=$MOODLE_PASSWORD \ @@ -139,25 +139,25 @@ upgrade_config_file() { # Function to configure Moodle settings via CLI configure_moodle_settings() { echo "Configuring settings..." - php83 -d max_input_vars=10000 /var/www/html/admin/cli/cfg.php --name=pathtophp --set=/usr/bin/php83 - php83 -d max_input_vars=10000 /var/www/html/admin/cli/cfg.php --name=pathtodu --set=/usr/bin/du - php83 -d max_input_vars=10000 /var/www/html/admin/cli/cfg.php --name=enableblogs --set=0 - php83 -d max_input_vars=10000 /var/www/html/admin/cli/cfg.php --name=smtphosts --set="$SMTP_HOST:$SMTP_PORT" - php83 -d max_input_vars=10000 /var/www/html/admin/cli/cfg.php --name=smtpuser --set="$SMTP_USER" - php83 -d max_input_vars=10000 /var/www/html/admin/cli/cfg.php --name=smtppass --set="$SMTP_PASSWORD" - php83 -d max_input_vars=10000 /var/www/html/admin/cli/cfg.php --name=smtpsecure --set="$SMTP_PROTOCOL" - php83 -d max_input_vars=10000 /var/www/html/admin/cli/cfg.php --name=noreplyaddress --set="$MOODLE_MAIL_NOREPLY_ADDRESS" - php83 -d max_input_vars=10000 /var/www/html/admin/cli/cfg.php --name=emailsubjectprefix --set="$MOODLE_MAIL_PREFIX" + php84 -d max_input_vars=10000 /var/www/html/admin/cli/cfg.php --name=pathtophp --set=/usr/bin/php84 + php84 -d max_input_vars=10000 /var/www/html/admin/cli/cfg.php --name=pathtodu --set=/usr/bin/du + php84 -d max_input_vars=10000 /var/www/html/admin/cli/cfg.php --name=enableblogs --set=0 + php84 -d max_input_vars=10000 /var/www/html/admin/cli/cfg.php --name=smtphosts --set="$SMTP_HOST:$SMTP_PORT" + php84 -d max_input_vars=10000 /var/www/html/admin/cli/cfg.php --name=smtpuser --set="$SMTP_USER" + php84 -d max_input_vars=10000 /var/www/html/admin/cli/cfg.php --name=smtppass --set="$SMTP_PASSWORD" + php84 -d max_input_vars=10000 /var/www/html/admin/cli/cfg.php --name=smtpsecure --set="$SMTP_PROTOCOL" + php84 -d max_input_vars=10000 /var/www/html/admin/cli/cfg.php --name=noreplyaddress --set="$MOODLE_MAIL_NOREPLY_ADDRESS" + php84 -d max_input_vars=10000 /var/www/html/admin/cli/cfg.php --name=emailsubjectprefix --set="$MOODLE_MAIL_PREFIX" # Check if DEBUG is set to true if [ "${DEBUG:-false}" = "true" ]; then echo "Enabling debug mode..." - php83 /var/www/html/admin/cli/cfg.php --name=debug --set=32767 # DEVELOPER - php83 /var/www/html/admin/cli/cfg.php --name=debugdisplay --set=1 + php84 /var/www/html/admin/cli/cfg.php --name=debug --set=32767 # DEVELOPER + php84 /var/www/html/admin/cli/cfg.php --name=debugdisplay --set=1 else echo "Disabling debug mode..." - php83 /var/www/html/admin/cli/cfg.php --name=debug --set=0 # NONE - php83 /var/www/html/admin/cli/cfg.php --name=debugdisplay --set=0 + php84 /var/www/html/admin/cli/cfg.php --name=debug --set=0 # NONE + php84 /var/www/html/admin/cli/cfg.php --name=debugdisplay --set=0 fi } @@ -174,9 +174,9 @@ final_configurations() { # Function to upgrade Moodle upgrade_moodle() { echo "Upgrading moodle..." - php83 -d max_input_vars=10000 /var/www/html/admin/cli/maintenance.php --enable - php83 -d max_input_vars=10000 /var/www/html/admin/cli/upgrade.php --non-interactive --allow-unstable - php83 -d max_input_vars=10000 /var/www/html/admin/cli/maintenance.php --disable + php84 -d max_input_vars=10000 /var/www/html/admin/cli/maintenance.php --enable + php84 -d max_input_vars=10000 /var/www/html/admin/cli/upgrade.php --non-interactive --allow-unstable + php84 -d max_input_vars=10000 /var/www/html/admin/cli/maintenance.php --disable } # Check the availability of the primary database @@ -209,14 +209,14 @@ fi upgrade_config_file # Check if the database is already installed -if php83 -d max_input_vars=10000 /var/www/html/admin/cli/isinstalled.php ; then +if php84 -d max_input_vars=10000 /var/www/html/admin/cli/isinstalled.php ; then install_database configure_moodle_settings final_configurations else configure_moodle_settings echo "Upgrading admin user" - php83 -d max_input_vars=10000 /var/www/html/admin/cli/update_admin_user.php --username=$MOODLE_USERNAME --password=$MOODLE_PASSWORD --email=$MOODLE_EMAIL + php84 -d max_input_vars=10000 /var/www/html/admin/cli/update_admin_user.php --username=$MOODLE_USERNAME --password=$MOODLE_PASSWORD --email=$MOODLE_EMAIL if [ -z "$AUTO_UPDATE_MOODLE" ] || [ "$AUTO_UPDATE_MOODLE" = true ]; then upgrade_moodle @@ -230,7 +230,7 @@ fi # Check if REDIS_HOST is set and not empty if [ -n "$REDIS_HOST" ]; then echo "Configuring redis cache..." - php83 -d max_input_vars=10000 /var/www/html/admin/cli/configure_redis.php ${REDIS_HOST} + php84 -d max_input_vars=10000 /var/www/html/admin/cli/configure_redis.php ${REDIS_HOST} fi # Execute post-install commands if the variable is set diff --git a/rootfs/etc/crontabs/nobody b/rootfs/etc/crontabs/nobody index ca9a30b..144acdd 100644 --- a/rootfs/etc/crontabs/nobody +++ b/rootfs/etc/crontabs/nobody @@ -1,2 +1,2 @@ -* * * * * /usr/bin/php83 /var/www/html/admin/cli/cron.php > /dev/null \ No newline at end of file +* * * * * /usr/bin/php84 /var/www/html/admin/cli/cron.php > /dev/null \ No newline at end of file diff --git a/rootfs/etc/nginx/nginx.conf b/rootfs/etc/nginx/nginx.conf deleted file mode 100644 index d923356..0000000 --- a/rootfs/etc/nginx/nginx.conf +++ /dev/null @@ -1,117 +0,0 @@ -worker_processes 1; -error_log stderr warn; -pid /run/nginx.pid; - -events { - worker_connections 1024; -} - -http { - include mime.types; - default_type application/octet-stream; - - # Define custom log format to include reponse times - log_format main_timed '$remote_addr - $remote_user [$time_local] "$request" ' - '$status $body_bytes_sent "$http_referer" ' - '"$http_user_agent" "$http_x_forwarded_for" ' - '$request_time $upstream_response_time $pipe $upstream_cache_status'; - - access_log /dev/stdout main_timed; - error_log /dev/stderr notice; - - keepalive_timeout 65; - - # Write temporary files to /tmp so they can be created as a non-privileged user - client_body_temp_path /tmp/client_temp; - proxy_temp_path /tmp/proxy_temp_path; - fastcgi_temp_path /tmp/fastcgi_temp; - uwsgi_temp_path /tmp/uwsgi_temp; - scgi_temp_path /tmp/scgi_temp; - - # Default server definition - server { - listen 8080 default_server; - server_name _; - - sendfile off; - - # Increase proxy buffers for large requests - proxy_buffer_size 128k; - proxy_buffers 4 256k; - proxy_busy_buffers_size 256k; - - # Upload limit - client_max_body_size ${client_max_body_size}; - client_body_buffer_size 128k; - - root /var/www/html; - index index.php index.html; - - location / { - # First attempt to serve request as file, then - # as directory, then fall back to index.php - try_files $uri $uri/ /index.php?q=$uri&$args; - } - - # Redirect server error pages to the static page /50x.html - error_page 500 502 503 504 /50x.html; - location = /50x.html { - root /var/lib/nginx/html; - } - - # Pass the PHP scripts to PHP-FPM listening on socket - location ~ [^/]\.php(/|$) { - fastcgi_split_path_info ^(.+\.php)(/.+)$; - fastcgi_pass unix:/run/php-fpm.sock; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - fastcgi_param SCRIPT_NAME $fastcgi_script_name; - fastcgi_param PATH_INFO $fastcgi_path_info; - fastcgi_index index.php; - include fastcgi_params; - } - - - # Hide all dot files but allow "Well-Known URIs" as per RFC 5785 - location ~ /\.(?!well-known).* { - return 404; - } - - # This should be after the php fpm rule and very close to the last nginx ruleset. - # Don't allow direct access to various internal files. See MDL-69333 - location ~ (/vendor/|/node_modules/|composer\.json|/readme|/README|readme\.txt|/upgrade\.txt|db/install\.xml|/fixtures/|/behat/|phpunit\.xml|\.lock|environment\.xml|doesnotexist) { - deny all; - return 404; - } - - - location ~* \.(jpg|jpeg|gif|png|css|js|ico|xml)$ { - expires 5d; - } - - # Deny access to . files, for security - location ~ /\. { - log_not_found off; - deny all; - } - - # Allow fpm ping and status from localhost - location ~ ^/(fpm-status|fpm-ping)$ { - access_log off; - allow 127.0.0.1; - deny all; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - include fastcgi_params; - fastcgi_pass unix:/run/php-fpm.sock; - } - } - - # Include other server configs - include /etc/nginx/conf.d/*.conf; - - gzip on; - gzip_proxied any; - gzip_types text/plain application/xml text/css text/js text/xml application/x-javascript text/javascript application/json application/xml+rss; - gzip_vary on; - gzip_disable "msie6"; - -}