Skip to content

Commit

Permalink
Alpine 3.21 update (#70)
Browse files Browse the repository at this point in the history
* Upgraded to alpine 3.21

* Removed unneded nginx.conf, better use from parent
  • Loading branch information
erseco authored Dec 9, 2024
1 parent dc1fa57 commit cc3c29a
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 146 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
<a href="https://www.buymeacoffee.com/erseco"><img src="https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png" height="20px"></a>

Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
42 changes: 21 additions & 21 deletions rootfs/docker-entrypoint-init.d/02-configure-moodle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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/ \
Expand All @@ -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 \
Expand Down Expand Up @@ -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

}
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion rootfs/etc/crontabs/nobody
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@

* * * * * /usr/bin/php83 /var/www/html/admin/cli/cron.php > /dev/null
* * * * * /usr/bin/php84 /var/www/html/admin/cli/cron.php > /dev/null
117 changes: 0 additions & 117 deletions rootfs/etc/nginx/nginx.conf

This file was deleted.

0 comments on commit cc3c29a

Please sign in to comment.