Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,5 @@ var/*

# Ignore node_modules folder
node_modules

.phpactor.json
54 changes: 54 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
FROM php:8.2-apache

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PHP version 8.2 is hard-coded into the Dockerfile here. In case developers want to use other PHP versions, might be better to declare a PHP_VERSION build time ARG variable and interpolate it into this FROM declaration. The value for PHP_VERSION can come from a .env file which is read in by docker-compose.yml.


# 1. Install System Dependencies (Minimal required for Gibbon)
# TODO: Pin version in apt get install
RUN apt-get update && apt-get install -y \
git \
unzip \
libicu-dev \
libzip-dev \
libpng-dev \
libjpeg-dev \
libfreetype6-dev \
libxml2-dev \
gettext \
&& rm -rf /var/lib/apt/lists/*

# 2. Install PHP Extensions
RUN docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install -j"$(nproc)" \
mysqli \
pdo_mysql \
gd \
zip \
intl \
xml \
gettext \
bcmath

# Enable Apache mod_rewrite
RUN a2enmod rewrite

# 3. Install Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer

WORKDIR /var/www/html

# 4. Clone Gibbon v31 (Latest Stable)
RUN git clone --depth 1 --branch v31.0.00 https://github.com/GibbonEdu/core.git . \

@pli888 pli888 Apr 27, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this will bake in the Gibbon version 31 source code into the Docker image. For a local development environment, it would be better to mount the source code as a volume in docker-compose.yml. Any changes made to the source code can then be seen in your local Gibbon installation running as a Docker application.

For a production deployment, baking in a specific version of Gibbon source code is correct, but the version number is still hard-coded.

&& rm -rf .git

# 5. Install PHP Dependencies
RUN composer install --no-dev --optimize-autoloader

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another way is to install composer dependencies outside of the Docker build process by executing docker-compose exec -T app composer install. This will shorten the Docker image build time.


# 6. Configure PHP for Gibbon (Upload limits, etc.)
RUN echo "upload_max_filesize = 50M" > /usr/local/etc/php/conf.d/gibbon.ini \
&& echo "post_max_size = 50M" >> /usr/local/etc/php/conf.d/gibbon.ini \
&& echo "max_input_vars = 5000" >> /usr/local/etc/php/conf.d/gibbon.ini \
&& echo "memory_limit = 256M" >> /usr/local/etc/php/conf.d/gibbon.ini

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PHP environment values are hardcoded here. Instead, could have an external PHP config file with these values in it then mount this config file as a volume in docker-compose.yaml.


# 7. Permissions (Crucial for the Web Installer to work)
RUN chown -R www-data:www-data /var/www/html \
&& chmod -R 755 /var/www/html

CMD ["apache2-foreground"]
6 changes: 6 additions & 0 deletions docker-compose.dev.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: "3.8"

services:
app:
ports:
- "8080:80"
26 changes: 26 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
version: "3.8"

services:
app:
build: .
container_name: gibbon_app
depends_on:
- db
restart: always

db:
image: mysql:8.0

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The version of MySQL is hardcoded here. Could keep the version number in a .env file instead so it can be more easily configured.

container_name: gibbon_db
environment:
- MYSQL_DATABASE=${MYSQL_DATABASE:-gibbon}
- MYSQL_USER=${MYSQL_USER:-gibbon}
- MYSQL_PASSWORD=${MYSQL_PASSWORD:-gibbonpass}
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:-rootpass}
volumes:
- gibbon_db_data:/var/lib/mysql
# Native password plugin ensures PHP can connect easily
command: --default-authentication-plugin=mysql_native_password
restart: always

volumes:
gibbon_db_data:
Loading